Manual
Manual
Manual
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Chapter 4: Parser C-Language Interface 69<br />
YYBACKUP (token, value );<br />
[Macro]<br />
Unshift a token. This macro is allowed only for rules that reduce a single value, and<br />
only when there is no look-ahead token. It is also disallowed in GLR parsers. It<br />
installs a look-ahead token with token type token and semantic value value; then it<br />
discards the value that was going to be reduced by this rule.<br />
If the macro is used when it is not valid, such as when there is a look-ahead token<br />
already, then it reports a syntax error with a message ‘cannot back up’ and performs<br />
ordinary error recovery.<br />
In either case, the rest of the action is not executed.<br />
YYEMPTY<br />
Value stored in yychar when there is no look-ahead token.<br />
YYEOF<br />
Value stored in yychar when the look-ahead is the end of the input stream.<br />
[Macro]<br />
[Macro]<br />
YYERROR;<br />
[Macro]<br />
Cause an immediate syntax error. This statement initiates error recovery just as if<br />
the parser itself had detected an error; however, it does not call yyerror, and does<br />
not print any message. If you want to print an error message, call yyerror explicitly<br />
before the ‘YYERROR;’ statement. See Chapter 6 [Error Recovery], page 83.<br />
YYRECOVERING<br />
[Macro]<br />
The expression YYRECOVERING () yields 1 when the parser is recovering from a syntax<br />
error, and 0 otherwise. See Chapter 6 [Error Recovery], page 83.<br />
yychar<br />
[Variable]<br />
Variable containing either the look-ahead token, or YYEOF when the look-ahead is the<br />
end of the input stream, or YYEMPTY when no look-ahead has been performed so the<br />
next token is not yet known. Do not modify yychar in a deferred semantic action<br />
(see Section 1.5.3 [GLR Semantic Actions], page 19). See Section 5.1 [Look-Ahead<br />
Tokens], page 71.<br />
yyclearin;<br />
[Macro]<br />
Discard the current look-ahead token. This is useful primarily in error rules. Do not<br />
invoke yyclearin in a deferred semantic action (see Section 1.5.3 [GLR Semantic<br />
Actions], page 19). See Chapter 6 [Error Recovery], page 83.<br />
yyerrok;<br />
[Macro]<br />
Resume generating error messages immediately for subsequent syntax errors. This is<br />
useful primarily in error rules. See Chapter 6 [Error Recovery], page 83.<br />
yylloc<br />
[Variable]<br />
Variable containing the look-ahead token location when yychar is not set to YYEMPTY<br />
or YYEOF. Do not modify yylloc in a deferred semantic action (see Section 1.5.3 [GLR<br />
Semantic Actions], page 19). See Section 3.6.2 [Actions and Locations], page 52.<br />
yylval<br />
[Variable]<br />
Variable containing the look-ahead token semantic value when yychar is not set<br />
to YYEMPTY or YYEOF. Do not modify yylval in a deferred semantic action (see<br />
Section 1.5.3 [GLR Semantic Actions], page 19). See Section 3.5.3 [Actions], page 47.