mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
* data/glr.c (yyreportSyntaxError): Fix off-by-one error in
checking against YYLAST that caused the parser to miss a potential alternative in its diagnostic. Problem reported by Maria Jose Moron Fernandez in <http://lists.gnu.org/archive/html/bug-bison/2006-05/msg00024.html>. * data/lalr1.cc (yysyntax_error_): Likewise. * data/yacc.c (yysyntax_error): Likewise. * tests/regression.at (_AT_DATA_DANCER_Y): Use static array for tokens, in case we run into an older C compiler. (_AT_DATA_EXPECT2_Y, AT_CHECK_EXPECT2): New macros. Use them to check for the off-by-one error fixed above.
This commit is contained in:
@@ -838,14 +838,14 @@ b4_error_verbose_if([, int tok])[)
|
||||
YYUSE (yystate);
|
||||
#if YYERROR_VERBOSE
|
||||
int yyn = yypact_[yystate];
|
||||
if (yypact_ninf_ < yyn && yyn < yylast_)
|
||||
if (yypact_ninf_ < yyn && yyn <= yylast_)
|
||||
{
|
||||
/* Start YYX at -YYN if negative to avoid negative indexes in
|
||||
YYCHECK. */
|
||||
int yyxbegin = yyn < 0 ? -yyn : 0;
|
||||
|
||||
/* Stay within bounds of both yycheck and yytname. */
|
||||
int yychecklim = yylast_ - yyn;
|
||||
int yychecklim = yylast_ - yyn + 1;
|
||||
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
||||
int count = 0;
|
||||
for (int x = yyxbegin; x < yyxend; ++x)
|
||||
|
||||
Reference in New Issue
Block a user