mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 23:03:04 +00:00
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:
committed by
Akim Demaille
parent
9b3bb25885
commit
93561c21e8
@@ -503,7 +503,7 @@ symbols.prec:
|
||||
symbol.prec
|
||||
{ $$ = symbol_list_sym_new ($1, @1); }
|
||||
| symbols.prec symbol.prec
|
||||
{ $$ = symbol_list_prepend ($1, symbol_list_sym_new ($2, @2)); }
|
||||
{ $$ = symbol_list_append ($1, symbol_list_sym_new ($2, @2)); }
|
||||
;
|
||||
|
||||
symbol.prec:
|
||||
@@ -516,12 +516,12 @@ symbols.1:
|
||||
symbol
|
||||
{ $$ = symbol_list_sym_new ($1, @1); }
|
||||
| symbols.1 symbol
|
||||
{ $$ = symbol_list_prepend ($1, symbol_list_sym_new ($2, @2)); }
|
||||
{ $$ = symbol_list_append ($1, symbol_list_sym_new ($2, @2)); }
|
||||
;
|
||||
|
||||
generic_symlist:
|
||||
generic_symlist_item { $$ = $1; }
|
||||
| generic_symlist generic_symlist_item { $$ = symbol_list_prepend ($1, $2); }
|
||||
| generic_symlist generic_symlist_item { $$ = symbol_list_append ($1, $2); }
|
||||
;
|
||||
|
||||
generic_symlist_item:
|
||||
|
||||
Reference in New Issue
Block a user