3.3 The error reporting function

When the parser encounters a syntax error it calls a user-defined function. It must be an Emacs Lisp function with one argument: a string containing the message to report.

By default the parser uses this function to report error messages:

Function: wisent-message string &rest args

Print a one-line message if wisent-parse-verbose-flag is set. Pass string and args arguments to message.

Please Note:

wisent-message uses the following function to print lexical tokens:

Function: wisent-token-to-string token

Return a printed representation of lexical token token.

The general printed form of a lexical token is:

token(value)@location

To control the verbosity of the parser you can set to non-nil this variable:

Option: wisent-parse-verbose-flag

non-nil means to issue more messages while parsing.

Or interactively use the command:

Command: wisent-parse-toggle-verbose-flag

Toggle whether to issue more messages while parsing.

When the error reporting function is entered the variable wisent-input contains the unexpected token as returned by the lexer.

The error reporting function can be called from a semantic action too using the special macro wisent-error. When called from a semantic action entered by error recovery (see Error recovery) the value of the variable wisent-recovering is non-nil.