mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
Fix precedence for end token.
Since Bison 2.3b, which restored the ability of precedence directives to assign user token numbers, doing so for user token number 0 has produced an assertion failure. * NEWS (2.5): Document fix. * src/symtab.c (symbol_user_token_number_set): In the case of the end token, don't decrement ntokens if it was never incremented. * tests/regression.at (Token number in precedence declaration): Extend.
This commit is contained in:
12
ChangeLog
12
ChangeLog
@@ -1,3 +1,15 @@
|
|||||||
|
2011-05-01 Joel E. Denny <joeldenny@joeldenny.org>
|
||||||
|
|
||||||
|
Fix precedence for end token.
|
||||||
|
Since Bison 2.3b, which restored the ability of precedence
|
||||||
|
directives to assign user token numbers, doing so for user token
|
||||||
|
number 0 has produced an assertion failure.
|
||||||
|
* NEWS (2.5): Document fix.
|
||||||
|
* src/symtab.c (symbol_user_token_number_set): In the case of the
|
||||||
|
end token, don't decrement ntokens if it was never incremented.
|
||||||
|
* tests/regression.at (Token number in precedence declaration):
|
||||||
|
Extend.
|
||||||
|
|
||||||
2011-05-01 Joel E. Denny <joeldenny@joeldenny.org>
|
2011-05-01 Joel E. Denny <joeldenny@joeldenny.org>
|
||||||
|
|
||||||
Prepare for 2.5 release.
|
Prepare for 2.5 release.
|
||||||
|
|||||||
10
NEWS
10
NEWS
@@ -343,6 +343,16 @@ Bison News
|
|||||||
|
|
||||||
bison -Wnone gram.y
|
bison -Wnone gram.y
|
||||||
|
|
||||||
|
** Precedence directives can now assign token number 0:
|
||||||
|
|
||||||
|
Since Bison 2.3b, which restored the ability of precedence
|
||||||
|
directives to assign token numbers, doing so for token number 0 has
|
||||||
|
produced an assertion failure. For example:
|
||||||
|
|
||||||
|
%left END 0
|
||||||
|
|
||||||
|
This bug has been fixed.
|
||||||
|
|
||||||
* Changes in version 2.4.3 (2010-08-05):
|
* Changes in version 2.4.3 (2010-08-05):
|
||||||
|
|
||||||
** Bison now obeys -Werror and --warnings=error for warnings about
|
** Bison now obeys -Werror and --warnings=error for warnings about
|
||||||
|
|||||||
@@ -368,10 +368,11 @@ symbol_user_token_number_set (symbol *sym, int user_token_number, location loc)
|
|||||||
if (user_token_number == 0)
|
if (user_token_number == 0)
|
||||||
{
|
{
|
||||||
endtoken = sym;
|
endtoken = sym;
|
||||||
endtoken->number = 0;
|
|
||||||
/* It is always mapped to 0, so it was already counted in
|
/* It is always mapped to 0, so it was already counted in
|
||||||
NTOKENS. */
|
NTOKENS. */
|
||||||
|
if (endtoken->number != NUMBER_UNDEFINED)
|
||||||
--ntokens;
|
--ntokens;
|
||||||
|
endtoken->number = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1205,12 +1205,15 @@ AT_DATA_GRAMMAR([input.y],
|
|||||||
%}
|
%}
|
||||||
|
|
||||||
%error-verbose
|
%error-verbose
|
||||||
|
%right END 0
|
||||||
%left TK1 1 TK2 2 "tok alias" 3
|
%left TK1 1 TK2 2 "tok alias" 3
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
start: TK1 sr_conflict "tok alias" ;
|
start:
|
||||||
|
TK1 sr_conflict "tok alias"
|
||||||
|
| start %prec END
|
||||||
|
;
|
||||||
sr_conflict:
|
sr_conflict:
|
||||||
TK2
|
TK2
|
||||||
| TK2 "tok alias"
|
| TK2 "tok alias"
|
||||||
@@ -1240,7 +1243,8 @@ main (void)
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([[-o input.c input.y]], [[0]],,
|
AT_BISON_CHECK([[-o input.c input.y]], [[0]],,
|
||||||
[[input.y:24.5-19: warning: rule useless in parser due to conflicts: sr_conflict: TK2 "tok alias"
|
[[input.y:23.5-19: warning: rule useless in parser due to conflicts: start: start
|
||||||
|
input.y:27.5-19: warning: rule useless in parser due to conflicts: sr_conflict: TK2 "tok alias"
|
||||||
]])
|
]])
|
||||||
AT_COMPILE([[input]])
|
AT_COMPILE([[input]])
|
||||||
AT_PARSER_CHECK([[./input]])
|
AT_PARSER_CHECK([[./input]])
|
||||||
|
|||||||
Reference in New Issue
Block a user