grammar: preserve token declaration order

In a declaration %token A B, the token A is declared before B, but in %left
A B (or with %precedence or %nonassoc or %right), the token B was declared
before A (tokens were declared in reverse order).

* src/symlist.h, src/symlist.c (symbol_list_append): New.
* src/parse-gram.y: Use it instead of symbol_list_prepend.
* tests/input.at: Adjust expectations.
This commit is contained in:
Valentin Tolmer
2013-01-25 11:12:47 +01:00
committed by Akim Demaille
parent 9b3bb25885
commit 93561c21e8
5 changed files with 33 additions and 7 deletions

6
NEWS
View File

@@ -289,6 +289,12 @@ GNU Bison NEWS
It used to be an error only if used in non GLR mode, _and_ if there are
reduce/reduce conflicts.
** Token numbering has changed to preserve the user-defined order
When declaring %token A B, the numbering for A is inferior to B. Up to now,
when declaring associativity at the same time, with %left (or %right,
%precedence, %nonassoc), B was inferior to A.
* Noteworthy changes in release 2.7 (2012-12-12) [stable]
** Bug fixes