Next: Internationalization, Previous: Error Reporting, Up: Interface [Contents][Index]
Here is a table of Bison constructs, variables and macros that are useful in actions.
Acts like a variable that contains the semantic value for the grouping made by the current rule. See Actions.
Acts like a variable that contains the semantic value for the nth component of the current rule. See Actions.
Like $$
but specifies alternative typealt in the union
specified by the %union
declaration. See Data
Types of Values in Actions.
Like $n
but specifies alternative typealt in the
union specified by the %union
declaration.
See Data Types of Values in Actions.
;
Return immediately from yyparse
, indicating failure.
See The Parser Function yyparse
.
;
Return immediately from yyparse
, indicating success.
See The Parser Function yyparse
.
;
Unshift a token. This macro is allowed only for rules that reduce a single value, and only when there is no lookahead token. It is also disallowed in GLR parsers. It installs a lookahead token with token type token and semantic value value; then it discards the value that was going to be reduced by this rule.
If the macro is used when it is not valid, such as when there is a lookahead token already, then it reports a syntax error with a message ‘cannot back up’ and performs ordinary error recovery.
In either case, the rest of the action is not executed.
Value stored in yychar
when there is no lookahead token.
Value stored in yychar
when the lookahead is the end of the input
stream.
;
Cause an immediate syntax error. This statement initiates error
recovery just as if the parser itself had detected an error; however, it
does not call yyerror
, and does not print any message. If you
want to print an error message, call yyerror
explicitly before
the ‘YYERROR;’ statement. See Error Recovery.
The expression YYRECOVERING ()
yields 1 when the parser
is recovering from a syntax error, and 0 otherwise.
See Error Recovery.
Variable containing either the lookahead token, or YYEOF
when the
lookahead is the end of the input stream, or YYEMPTY
when no lookahead
has been performed so the next token is not yet known.
Do not modify yychar
in a deferred semantic action (see GLR Semantic Actions).
See Lookahead Tokens.
;
Discard the current lookahead token. This is useful primarily in
error rules.
Do not invoke yyclearin
in a deferred semantic action (see GLR Semantic Actions).
See Error Recovery.
;
Resume generating error messages immediately for subsequent syntax errors. This is useful primarily in error rules. See Error Recovery.
Variable containing the lookahead token location when yychar
is not set
to YYEMPTY
or YYEOF
.
Do not modify yylloc
in a deferred semantic action (see GLR Semantic Actions).
See Actions and Locations.
Variable containing the lookahead token semantic value when yychar
is
not set to YYEMPTY
or YYEOF
.
Do not modify yylval
in a deferred semantic action (see GLR Semantic Actions).
See Actions.
Acts like a structure variable containing information on the textual location of the grouping made by the current rule. See Tracking Locations.
Acts like a structure variable containing information on the textual location of the nth component of the current rule. See Tracking Locations.
Next: Internationalization, Previous: Error Reporting, Up: Interface [Contents][Index]