mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
Commit90a8537e62was right, but issued two error messages. Commit80ef7e7639tried to address that by mapping yychar and yytoken to empty, but that completely breaks the invariants of glr.c. In particular, yygetToken can be called repeatedly and is expected to return the latest result, unless yytoken is YYEMPTY. Since the previous attempt was "recording" that the token was coming from an exception by setting it to YYEMPTY, instead of getting again the faulty token, we fetched another one. Rather, revert to the first approach: map yytoken to "invalid token", but record in yychar the fact that we come from an exception thrown in the scanner. * data/skeletons/glr.c (YYFAULTYTOK): New. (yygetToken): Use it to record syntax errors from the scanner. * tests/c++.at (Syntax error as exception): In addition to checking syntax_error with error recovery, make sure it also behaves as expected without.