Method
GLibScannerunexp_token
Declaration
void
g_scanner_unexp_token (
GScanner* scanner,
GTokenType expected_token,
const gchar* identifier_spec,
const gchar* symbol_spec,
const gchar* symbol_name,
const gchar* message,
gint is_error
)
Description
Outputs a message through the scanner’s msg_handler,
resulting from an unexpected token in the input stream.
Note that you should not call g_scanner_peek_next_token()
followed by g_scanner_unexp_token() without an intermediate
call to g_scanner_get_next_token(), as g_scanner_unexp_token()
evaluates the scanner’s current token (not the peeked token)
to construct part of the message.
Parameters
expected_token-
Type:
GTokenTypeThe expected token.
identifier_spec-
Type:
const gchar*A string describing how the scanner’s user refers to identifiers (
NULLdefaults to “identifier”). This is used ifexpected_tokenisG_TOKEN_IDENTIFIERorG_TOKEN_IDENTIFIER_NULL.The data is owned by the caller of the method. The value is a NUL terminated UTF-8 string. symbol_spec-
Type:
const gchar*A string describing how the scanner’s user refers to symbols (
NULLdefaults to “symbol”). This is used ifexpected_tokenisG_TOKEN_SYMBOLor any token value greater thanG_TOKEN_LAST.The data is owned by the caller of the method. The value is a NUL terminated UTF-8 string. symbol_name-
Type:
const gchar*The name of the symbol, if the scanner’s current token is a symbol.
The data is owned by the caller of the method. The value is a NUL terminated UTF-8 string. message-
Type:
const gchar*A message string to output at the end of the warning/error, or
NULL.The data is owned by the caller of the method. The value is a NUL terminated UTF-8 string. is_error-
Type:
gintIf
TRUEit is output as an error. IfFALSEit is output as a warning.