mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 14:53:03 +00:00
lalr1, yacc: use the default location as initial error location
Currently lalr1.cc makes an out-of-bound access when trying to read @1 in rules with an empty rhs (i.e., when there is no @1) that raises an error (YYERROR). glr.c already gracefully handles this by using @$ as initial location for the errors. Let's do that in yacc.c and lalr1.cc. * data/lalr1.cc, data/yacc.c: Use @$ to initialize the error location. * tests/actions.at: Check that case.
This commit is contained in:
11
NEWS
11
NEWS
@@ -2,6 +2,17 @@ GNU Bison NEWS
|
||||
|
||||
* Noteworthy changes in release ?.? (????-??-??) [?]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
*** Location of errors
|
||||
|
||||
In C++ parsers, out-of-bounds errors can happen when a rule with an empty
|
||||
ride-hand side raises a syntax error. The behavior of the default parser
|
||||
(yacc.c) in such a condition was undefined.
|
||||
|
||||
Now all the parsers match the behavior of glr.c: @$ is used as the
|
||||
location of the error. This handles gracefully rules with and without
|
||||
rhs.
|
||||
|
||||
* Noteworthy changes in release 3.0.4 (2015-01-23) [stable]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user