On this page:
current-report-configuration
report-configuration?

1.10 Configuring Error Reporting🔗ℹ

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

Added in version 8.9.0.5 of package base.

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. This parameter is cross-phase persistent, which means that the parameter and its value are shared across phases.

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.

Changed in version 8.15.0.4 of package base: Changed parameter to cross-phase persistent.

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.