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:
Akim Demaille
2019-09-08 11:38:29 +02:00
parent 375eb71489
commit f8db8fe4d7
3 changed files with 9 additions and 2 deletions
+1
View File
@@ -100,6 +100,7 @@ Lie Yan [email protected]
Magnus Fromreide [email protected]
Marc Autret [email protected]
Marc Mendiola [email protected]
Marc Schönefeld [email protected]
Mark Boyall [email protected]
Martin Jacobs [email protected]
Martin Mokrejs [email protected]