mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
fix: don't die when EOF token is defined twice
With
%token EOF 0 EOF 0
we get
input.y:3.14-16: warning: symbol EOF redeclared [-Wother]
3 | %token EOF 0 EOF 0
| ^~~
input.y:3.8-10: previous declaration
3 | %token EOF 0 EOF 0
| ^~~
Assertion failed: (nsyms == ntokens + nvars), function check_and_convert_grammar,
file /Users/akim/src/gnu/bison/src/reader.c, line 839.
Reported by Marc Schönefeld.
* src/symtab.c (symbol_user_token_number_set): Register only the
first definition of the end of input token.
* tests/input.at (Symbol redeclared): Check that case.
This commit is contained in:
@@ -624,7 +624,7 @@ AT_SETUP([Symbol redeclared])
|
||||
AT_DATA([[input.y]],
|
||||
[[%token FOO FOO
|
||||
%token BAR 12 BAR 12
|
||||
|
||||
%token EOF 0 EOF 0
|
||||
%%
|
||||
exp: FOO BAR
|
||||
]])
|
||||
@@ -642,6 +642,12 @@ input.y:2.15-17: warning: symbol BAR redeclared [-Wother]
|
||||
input.y:2.8-10: previous declaration
|
||||
2 | %token BAR 12 BAR 12
|
||||
| ^~~
|
||||
input.y:3.14-16: warning: symbol EOF redeclared [-Wother]
|
||||
3 | %token EOF 0 EOF 0
|
||||
| ^~~
|
||||
input.y:3.8-10: previous declaration
|
||||
3 | %token EOF 0 EOF 0
|
||||
| ^~~
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
Reference in New Issue
Block a user