mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-12 13:53:03 +00:00
Fix handling of yychar manipulation in user semantic actions.
The problem was that yacc.c didn't always update the yychar translation afterwards. However, other skeletons appear to be fine. glr.c appears to already translate yychar before every use. lalr1.cc does not define yychar and does not document its replacement, yyla, for users. It does provide yyclearin, but that does not manipulate yyla and thus requires no translation update. In lalr1.java, yychar is out of scope during semantic actions. * NEWS (2.5): Document. * data/yacc.c (YYBACKUP): Don't bother translating yychar into yytoken here. (yyparse, yypush_parse): Instead, translate before every use of yytoken, and add comments explaining this approach. * tests/actions.at (Destroying lookahead assigned by semantic action): New test group checking that translation happens before lookahead destructor calls at parser return. Previously, incorrect destructors were called. * tests/conflicts.at (parse.error=verbose and consistent errors): New test group checking that translation happens at syntax error detection before the associated verbose error message and the associated lookahead destructor calls. While the destructor call is fixed by this patch, the verbose error message is currently incorrect due to another bug (see comments in test group), so this is an expected failure for now.
This commit is contained in:
7
NEWS
7
NEWS
@@ -223,6 +223,13 @@ Bison News
|
||||
were resolved with %nonassoc. Such tokens are now properly omitted
|
||||
from the list.
|
||||
|
||||
** Destructor calls fixed for lookaheads altered in semantic actions.
|
||||
|
||||
Previously for deterministic parsers in C, if a user semantic action
|
||||
altered yychar, the parser in some cases used the old yychar value to
|
||||
determine which destructor to call for the lookahead upon a syntax
|
||||
error or upon parser return. This bug has been fixed.
|
||||
|
||||
* Changes in version 2.4.2 (????-??-??):
|
||||
|
||||
** Detection of GNU M4 1.4.6 or newer during configure is improved.
|
||||
|
||||
Reference in New Issue
Block a user