unexp_token


Description:

public void unexp_token (TokenType expected_token, string? identifier_spec, string? symbol_spec, string? symbol_name, string? message, bool is_error)

Outputs a message through the scanner's msg_handler, resulting from an unexpected token in the input stream.

Note that you should not call peek_next_token followed by unexp_token without an intermediate call to get_next_token, as unexp_token evaluates the scanner's current token (not the peeked token) to construct part of the message.

Parameters:

this

a Scanner

expected_token

the expected token

identifier_spec

a string describing how the scanner's user refers to identifiers (null defaults to "identifier"). This is used if expected_token is g_token_identifier or g_token_identifier_null.

symbol_spec

a string describing how the scanner's user refers to symbols (null defaults to "symbol"). This is used if expected_token is g_token_symbol or any token value greater than g_token_last.

symbol_name

the name of the symbol, if the scanner's current token is a symbol.

message

a message string to output at the end of the warning/error, or null.

is_error

if true it is output as an error. If false it is output as a warning.