mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
gram: correct token numbering in precedence declarations
In a precedence declaration, when tokens are declared with a litteral character (e.g., 'a') or with a identifier (e.g., B), Bison behaved differently: the litteral tokens would be numbered first, and then the other ones, leading to the following grammar: %right A B 'c' 'd' being numbered as such: 'c' 'd' A B. * src/parse-gram.y (symbol.prec): Set the symbol number when reading the symbols. * tests/conflicts.at (Token declaration order: literals vs. identifiers): New. Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
This commit is contained in:
committed by
Akim Demaille
parent
02879b4e81
commit
5202b6ac1d
@@ -503,8 +503,17 @@ symbols.prec:
|
||||
;
|
||||
|
||||
symbol.prec:
|
||||
symbol { $$ = $1; }
|
||||
| symbol INT { $$ = $1; symbol_user_token_number_set ($1, $2, @2); }
|
||||
symbol
|
||||
{
|
||||
$$ = $1;
|
||||
symbol_class_set ($1, token_sym, @1, false);
|
||||
}
|
||||
| symbol INT
|
||||
{
|
||||
$$ = $1;
|
||||
symbol_user_token_number_set ($1, $2, @2);
|
||||
symbol_class_set ($1, token_sym, @1, false);
|
||||
}
|
||||
;
|
||||
|
||||
/* One or more symbols to be %typed. */
|
||||
|
||||
Reference in New Issue
Block a user