d: add support for lookahead correction

When using lookahead correction, the method YYParser.Context.getExpectedTokens
is not annotated with const, because the method calls yylacCheck, which is not
const. Also, because of yylacStack and yylacEstablished, yylacCheck needs to
be called from the context of the parser class, which is sent as parameter to
the Context's constructor.

* data/skeletons/lalr1.d (yylacCheck, yylacEstablish, yylacDiscard,
yylacStack, yylacEstablished): New.
(Context): Use it.
* doc/bison.texi: Document it.
* tests/calc.at: Check it.
This commit is contained in:
Adela Vais
2020-11-17 16:44:52 +02:00
committed by Akim Demaille
parent 0e51f6146a
commit 593724366f
3 changed files with 229 additions and 25 deletions

View File

@@ -6885,7 +6885,7 @@ introduced in 3.0 with support for @code{simple} and @code{verbose}. Values
@deffn Directive {%define parse.lac} @var{when}
@itemize
@item Languages(s): C/C++ (deterministic parsers only), and Java.
@item Languages(s): C/C++ (deterministic parsers only), D and Java.
@item Purpose: Enable LAC (lookahead correction) to improve
syntax error handling. @xref{LAC}.