1.10 Configuring Error Reporting

► |  | Syntax: Meta-Programming Helpers

1 | Parsing and Specifying Syntax
2 | Syntax Object Helpers
3 | Datum Pattern Matching
4 | Module-Processing Helpers
5 | Macro Transformer Helpers
6 | Reader Helpers
7 | Parsing for Bodies
8 | Unsafe for Clause Transforms
9 | Source Locations
10 | Preserving Source Locations
11 | Non-Module Compilation And Expansion
12 | Trusting Standard Recertifying Transformers
13 | Attaching Documentation to Exports
14 | Contracts for Macro Subexpressions
15 | Macro Testing
16 | Internal-Definition Context Helpers
| Index

▼ | 1 | Parsing and Specifying Syntax

1.1 | Introduction
1.2 | Examples
1.3 | Parsing Syntax
1.4 | Specifying Syntax with Syntax Classes
1.5 | Syntax Patterns
1.6 | Defining Simple Macros
1.7 | Literal Sets and Conventions
1.8 | Library Syntax Classes and Literal Sets
1.9 | Unwindable State
1.10 | Configuring Error Reporting
1.11 | Debugging and Inspection Tools
1.12 | Experimental
1.13 | Minimal Library

On this page:

current-report-configuration
report-configuration?

top contents ← prev up next →

#### 1.10`` Configuring Error Reporting🔗ℹ

(require syntax/parse/report-config) | package: base

Added in version 8.9.0.5 of package base.

> parameter (current-report-configuration) → report-configuration?
> (current-report-configuration config) → void?
> config : report-configuration?

A parameter that determines parts error messages that are generated by syntax-parse for failed matches. When syntax-parse needs to report that a particular datum or literal identifier was expected, it consults the configuration in this parameter.

A configuration is a hash table with the following keys:

- 'datum-to-what — a procedure of one argument used to get a noun describing an expected datum, which appears in a pattern either with ~datum, as “self-quoting,” or so on. The procedure’s argument is the datum value. The result must be either a string or a list containing two strings; if two strings are provided, the first is used when a singular noun is needed, and the second is used as a plural noun.

  The default configuration returns '("literal symbol" "literal symbols") for a symbol and '("literal" "literals") for any other datum value.

- 'datum-to-string — a procedure of one argument, used to convert the datum value to a string that is included in the error message. The procedure’s argument is the datum value, and the result must be a string.

  The default configuration formats a symbol value using (format "`~s'" v) any other datum value using (format "~s" v).

- 'literal-to-what — a procedure of one argument used to get a noun describing an expected literal identifier, which appears in a pattern with ~literal, as declared with #:literals, or so on. The procedure’s argument is an identifier when available, or a symbol when only simplified information has been preserved. The result must be either a string or a list containing two strings, like the result for a 'datum-to-what procedure.

  The default configuration returns '("identifier" "identifiers").

- 'literal-to-string — a procedure of one argument, used to convert a literal identifier or symbol to a string that is included in the error message.

  The default configuration formats a symbol value using (format "`~s'" v), and it formats an identifier the same after extracting its symbol with syntax-e.

> procedure (report-configuration? v) → boolean?
> v : any/c

Checks whether v is an immutable hash table that maps each of the keys 'datum-to-what, 'datum-to-string 'identifier-to-what and 'identifier-to-string to a procedure that accepts one argument.
top contents ← prev up next →