lalr1.cc: add LAC support

Implement lookahead correction (LAC) for the C++ skeleton.  LAC is a
mechanism to make sure that we report the correct list of expected
tokens if a syntax error occurs.  So far, LAC was only supported for
the C skeleton "yacc.c".

* data/skeletons/lalr1.cc: Add LAC support.
* doc/bison.texi: Update.
This commit is contained in:
Adrian Vogelsgesang
2019-01-03 02:00:58 +01:00
committed by Akim Demaille
parent 996abe62d7
commit 72d4ae5306
2 changed files with 216 additions and 19 deletions

View File

@@ -8697,7 +8697,7 @@ Enable LAC to improve syntax error handling.
@item @code{none} (default)
@item @code{full}
@end itemize
This feature is currently only available for deterministic parsers in C.
This feature is currently only available for deterministic parsers in C and C++.
@end deffn
Conceptually, the LAC mechanism is straight-forward. Whenever the parser
@@ -11685,7 +11685,7 @@ location (if enabled) being @var{yylval} and @var{yylloc}. Invocations of
Note that when using variants, the interface for @code{yylex} is the same,
but @code{yylval} is handled differently.
Regular union-based code in Lex scanner typically look like:
Regular union-based code in Lex scanner typically looks like:
@example
[0-9]+ @{