mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 01:33:03 +00:00
(struct yyGLRStack): yyerror_range now has 3 items,
not 2, since it's not portable to subtract 1 from the start of an array. The new item 0 is never set or used. All uses changed. (yyrecoverSyntaxError): Use YYLLOC_DEFAULT instead of assuming the default definition of YYLLOC_DEFAULT. Problem reported by Frank Heckenbach.
This commit is contained in:
24
data/glr.c
24
data/glr.c
@@ -612,8 +612,8 @@ union yyGLRStackItem {
|
|||||||
struct yyGLRStack {
|
struct yyGLRStack {
|
||||||
int yyerrflag;
|
int yyerrflag;
|
||||||
int yyerrState;
|
int yyerrState;
|
||||||
]b4_location_if([[ /* To compute the location of the error token, */
|
]b4_location_if([[ /* To compute the location of the error token. */
|
||||||
yyGLRStackItem yyerror_range[2];]])[
|
yyGLRStackItem yyerror_range[3];]])[
|
||||||
]b4_pure_if(
|
]b4_pure_if(
|
||||||
[
|
[
|
||||||
int yyerrcnt;
|
int yyerrcnt;
|
||||||
@@ -1722,7 +1722,7 @@ yyrecoverSyntaxError (yyGLRStack* yystack,
|
|||||||
while (yystack->yytops.yystates[0] != NULL)
|
while (yystack->yytops.yystates[0] != NULL)
|
||||||
{
|
{
|
||||||
yyGLRState *yys = yystack->yytops.yystates[0];
|
yyGLRState *yys = yystack->yytops.yystates[0];
|
||||||
]b4_location_if([[ yystack->yyerror_range[0].yystate.yyloc = yys->yyloc;]])[
|
]b4_location_if([[ yystack->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
|
||||||
yydestruct ("Error: popping",
|
yydestruct ("Error: popping",
|
||||||
yystos[yys->yylrState],
|
yystos[yys->yylrState],
|
||||||
&yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[);
|
&yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[);
|
||||||
@@ -1737,8 +1737,10 @@ yyrecoverSyntaxError (yyGLRStack* yystack,
|
|||||||
/* We throw away the lookahead, but the error range
|
/* We throw away the lookahead, but the error range
|
||||||
of the shifted error token must take it into account. */
|
of the shifted error token must take it into account. */
|
||||||
yyGLRState *yys = yystack->yytops.yystates[0];
|
yyGLRState *yys = yystack->yytops.yystates[0];
|
||||||
yys->yyloc.last_line = yyllocp->last_line;
|
yyGLRStackItem yyerror_range[3];
|
||||||
yys->yyloc.last_column = yyllocp->last_column;]])[
|
yyerror_range[1].yystate.yyloc = yys->yyloc;
|
||||||
|
yyerror_range[2].yystate.yyloc = *yyllocp;
|
||||||
|
YYLLOC_DEFAULT (yys->yyloc, yyerror_range, 2);]])[
|
||||||
yydestruct ("Error: discarding",
|
yydestruct ("Error: discarding",
|
||||||
*yytokenp, yylvalp]b4_location_if([, yyllocp])[);
|
*yytokenp, yylvalp]b4_location_if([, yyllocp])[);
|
||||||
}
|
}
|
||||||
@@ -1784,8 +1786,8 @@ yyrecoverSyntaxError (yyGLRStack* yystack,
|
|||||||
{
|
{
|
||||||
/* Shift the error token having adjusted its location. */
|
/* Shift the error token having adjusted its location. */
|
||||||
YYLTYPE yyerrloc;]b4_location_if([[
|
YYLTYPE yyerrloc;]b4_location_if([[
|
||||||
yystack->yyerror_range[1].yystate.yyloc = *yyllocp;
|
yystack->yyerror_range[2].yystate.yyloc = *yyllocp;
|
||||||
YYLLOC_DEFAULT (yyerrloc, yystack->yyerror_range - 1, 2);]])[
|
YYLLOC_DEFAULT (yyerrloc, yystack->yyerror_range, 2);]])[
|
||||||
YY_SYMBOL_PRINT ("Shifting", yystos[yytable[yyj]],
|
YY_SYMBOL_PRINT ("Shifting", yystos[yytable[yyj]],
|
||||||
yylvalp, &yyerrloc);
|
yylvalp, &yyerrloc);
|
||||||
yyglrShift (yystack, 0, yytable[yyj],
|
yyglrShift (yystack, 0, yytable[yyj],
|
||||||
@@ -1794,7 +1796,7 @@ yyrecoverSyntaxError (yyGLRStack* yystack,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]b4_location_if([[ yystack->yyerror_range[0].yystate.yyloc = yys->yyloc;]])[
|
]b4_location_if([[ yystack->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
|
||||||
yydestruct ("Error: popping",
|
yydestruct ("Error: popping",
|
||||||
yystos[yys->yylrState],
|
yystos[yys->yylrState],
|
||||||
&yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[);
|
&yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[);
|
||||||
@@ -1893,7 +1895,7 @@ b4_syncline([@oline@], [@ofile@])])dnl
|
|||||||
yyrule = yydefaultAction (yystate);
|
yyrule = yydefaultAction (yystate);
|
||||||
if (yyrule == 0)
|
if (yyrule == 0)
|
||||||
{
|
{
|
||||||
]b4_location_if([[ yystack.yyerror_range[0].yystate.yyloc = *yyllocp;]])[
|
]b4_location_if([[ yystack.yyerror_range[1].yystate.yyloc = *yyllocp;]])[
|
||||||
yyreportSyntaxError (&yystack, yylvalp, yyllocp]b4_user_args[);
|
yyreportSyntaxError (&yystack, yylvalp, yyllocp]b4_user_args[);
|
||||||
goto yyuser_error;
|
goto yyuser_error;
|
||||||
}
|
}
|
||||||
@@ -1924,7 +1926,7 @@ b4_syncline([@oline@], [@ofile@])])dnl
|
|||||||
}
|
}
|
||||||
else if (yyisErrorAction (yyaction))
|
else if (yyisErrorAction (yyaction))
|
||||||
{
|
{
|
||||||
]b4_location_if([[ yystack.yyerror_range[0].yystate.yyloc = *yyllocp;]])[
|
]b4_location_if([[ yystack.yyerror_range[1].yystate.yyloc = *yyllocp;]])[
|
||||||
yyreportSyntaxError (&yystack, yylvalp, yyllocp]b4_user_args[);
|
yyreportSyntaxError (&yystack, yylvalp, yyllocp]b4_user_args[);
|
||||||
goto yyuser_error;
|
goto yyuser_error;
|
||||||
}
|
}
|
||||||
@@ -1950,7 +1952,7 @@ b4_syncline([@oline@], [@ofile@])])dnl
|
|||||||
yyFail (&yystack][]b4_lpure_args[, "syntax error");
|
yyFail (&yystack][]b4_lpure_args[, "syntax error");
|
||||||
YYCHK1 (yyresolveStack (&yystack]b4_user_args[));
|
YYCHK1 (yyresolveStack (&yystack]b4_user_args[));
|
||||||
YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));
|
YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));
|
||||||
]b4_location_if([[ yystack.yyerror_range[0].yystate.yyloc = *yyllocp;]])[
|
]b4_location_if([[ yystack.yyerror_range[1].yystate.yyloc = *yyllocp;]])[
|
||||||
yyreportSyntaxError (&yystack, yylvalp, yyllocp]b4_user_args[);
|
yyreportSyntaxError (&yystack, yylvalp, yyllocp]b4_user_args[);
|
||||||
goto yyuser_error;
|
goto yyuser_error;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user