mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-21 10:13:03 +00:00
glr: do not use locations when they are not requested
When the test suite runs with -O2 and warnings enabled, G++ complains of locations being used, but not initialized. The simplest is to not use locations. * data/glr.c (b4_locuser_formals, b4_locuser_args): New. Use them when locations should not be used. Use b4_locations_if where appropriate. (yyuserAction): Modify the order to the arguments to make it more alike the other routines, and to make use of b4_locuser_args simpler.
This commit is contained in:
150
data/glr.c
150
data/glr.c
@@ -93,13 +93,27 @@ m4_define([b4_lpure_args],
|
|||||||
[b4_pure_if([b4_locations_if([, &yylloc])])[]b4_user_args])
|
[b4_pure_if([b4_locations_if([, &yylloc])])[]b4_user_args])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_pure_formals
|
# b4_pure_formals
|
||||||
# ---------------
|
# ---------------
|
||||||
# Arguments passed to yyerror: user formals plus yylocp.
|
# Arguments passed to yyerror: user formals plus yylocp with leading comma.
|
||||||
m4_define([b4_pure_formals],
|
m4_define([b4_pure_formals],
|
||||||
[b4_pure_if([b4_locations_if([, YYLTYPE *yylocp])])[]b4_user_formals])
|
[b4_pure_if([b4_locations_if([, YYLTYPE *yylocp])])[]b4_user_formals])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_locuser_formals(LOC = yylocp)
|
||||||
|
# --------------------------------
|
||||||
|
m4_define([b4_locuser_formals],
|
||||||
|
[b4_locations_if([, YYLTYPE *m4_default([$1], [yylocp])])[]b4_user_formals])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_locuser_args(LOC = yylocp)
|
||||||
|
# -----------------------------
|
||||||
|
m4_define([b4_locuser_args],
|
||||||
|
[b4_locations_if([, m4_default([$1], [yylocp])])[]b4_user_args])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
## Semantic Values. ##
|
## Semantic Values. ##
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
@@ -582,15 +596,14 @@ do { \
|
|||||||
|
|
||||||
]b4_yy_symbol_print_generate([b4_c_ansi_function_def])[
|
]b4_yy_symbol_print_generate([b4_c_ansi_function_def])[
|
||||||
|
|
||||||
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
{ \
|
{ \
|
||||||
YYFPRINTF (stderr, "%s ", Title); \
|
YYFPRINTF (stderr, "%s ", Title); \
|
||||||
yy_symbol_print (stderr, Type, \
|
yy_symbol_print (stderr, Type, Value]b4_locuser_args([Location])[); \
|
||||||
Value]b4_locations_if([, Location])[]b4_user_args[); \
|
YYFPRINTF (stderr, "\n"); \
|
||||||
YYFPRINTF (stderr, "\n"); \
|
} \
|
||||||
} \
|
|
||||||
} while (YYID (0))
|
} while (YYID (0))
|
||||||
|
|
||||||
/* Nonzero means print parse trace. It is left uninitialized so that
|
/* Nonzero means print parse trace. It is left uninitialized so that
|
||||||
@@ -896,10 +909,8 @@ yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal)
|
|||||||
* yyerr for YYERROR, yyabort for YYABORT. */
|
* yyerr for YYERROR, yyabort for YYABORT. */
|
||||||
/*ARGSUSED*/ static YYRESULTTAG
|
/*ARGSUSED*/ static YYRESULTTAG
|
||||||
yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
|
yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
|
||||||
YYSTYPE* yyvalp,
|
yyGLRStack* yystackp,
|
||||||
YYLTYPE* YYOPTIONAL_LOC (yylocp),
|
YYSTYPE* yyvalp]b4_locuser_formals[)
|
||||||
yyGLRStack* yystackp
|
|
||||||
]b4_user_formals[)
|
|
||||||
{
|
{
|
||||||
yybool yynormal __attribute__ ((__unused__)) =
|
yybool yynormal __attribute__ ((__unused__)) =
|
||||||
(yystackp->yysplitPoint == YY_NULL);
|
(yystackp->yysplitPoint == YY_NULL);
|
||||||
@@ -928,9 +939,9 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
|
|||||||
if (yyrhslen == 0)
|
if (yyrhslen == 0)
|
||||||
*yyvalp = yyval_default;
|
*yyvalp = yyval_default;
|
||||||
else
|
else
|
||||||
*yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval;
|
*yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval;]b4_locations_if([[
|
||||||
YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen);
|
YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen);
|
||||||
]b4_locations_if([[ yystackp->yyerror_range[1].yystate.yyloc = *yylocp;
|
yystackp->yyerror_range[1].yystate.yyloc = *yylocp;
|
||||||
]])[
|
]])[
|
||||||
switch (yyn)
|
switch (yyn)
|
||||||
{
|
{
|
||||||
@@ -978,7 +989,7 @@ yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[)
|
|||||||
{
|
{
|
||||||
if (yys->yyresolved)
|
if (yys->yyresolved)
|
||||||
yydestruct (yymsg, yystos[yys->yylrState],
|
yydestruct (yymsg, yystos[yys->yylrState],
|
||||||
&yys->yysemantics.yysval]b4_locations_if([, &yys->yyloc])[]b4_user_args[);
|
&yys->yysemantics.yysval]b4_locuser_args([&yys->yyloc])[);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if YYDEBUG
|
#if YYDEBUG
|
||||||
@@ -989,7 +1000,7 @@ yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[)
|
|||||||
else
|
else
|
||||||
YYFPRINTF (stderr, "%s incomplete ", yymsg);
|
YYFPRINTF (stderr, "%s incomplete ", yymsg);
|
||||||
yy_symbol_print (stderr, yystos[yys->yylrState],
|
yy_symbol_print (stderr, yystos[yys->yylrState],
|
||||||
YY_NULL]b4_locations_if([, &yys->yyloc])[]b4_user_args[);
|
YY_NULL]b4_locuser_args([&yys->yyloc])[);
|
||||||
YYFPRINTF (stderr, "\n");
|
YYFPRINTF (stderr, "\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1120,8 +1131,8 @@ yyaddDeferredAction (yyGLRStack* yystackp, size_t yyk, yyGLRState* yystate,
|
|||||||
if (yystackp->yytops.yylookaheadNeeds[yyk])
|
if (yystackp->yytops.yylookaheadNeeds[yyk])
|
||||||
{
|
{
|
||||||
yynewOption->yyrawchar = yychar;
|
yynewOption->yyrawchar = yychar;
|
||||||
yynewOption->yyval = yylval;
|
yynewOption->yyval = yylval;]b4_locations_if([
|
||||||
yynewOption->yyloc = yylloc;
|
yynewOption->yyloc = yylloc;])[
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
yynewOption->yyrawchar = YYEMPTY;
|
yynewOption->yyrawchar = YYEMPTY;
|
||||||
@@ -1326,7 +1337,7 @@ yyremoveDeletes (yyGLRStack* yystackp)
|
|||||||
static inline void
|
static inline void
|
||||||
yyglrShift (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
|
yyglrShift (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
|
||||||
size_t yyposn,
|
size_t yyposn,
|
||||||
YYSTYPE* yyvalp, YYLTYPE* yylocp)
|
YYSTYPE* yyvalp]b4_locations_if([, YYLTYPE* yylocp])[)
|
||||||
{
|
{
|
||||||
yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
|
yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
|
||||||
|
|
||||||
@@ -1334,8 +1345,8 @@ yyglrShift (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
|
|||||||
yynewState->yyposn = yyposn;
|
yynewState->yyposn = yyposn;
|
||||||
yynewState->yyresolved = yytrue;
|
yynewState->yyresolved = yytrue;
|
||||||
yynewState->yypred = yystackp->yytops.yystates[yyk];
|
yynewState->yypred = yystackp->yytops.yystates[yyk];
|
||||||
yynewState->yysemantics.yysval = *yyvalp;
|
yynewState->yysemantics.yysval = *yyvalp;]b4_locations_if([
|
||||||
yynewState->yyloc = *yylocp;
|
yynewState->yyloc = *yylocp;])[
|
||||||
yystackp->yytops.yystates[yyk] = yynewState;
|
yystackp->yytops.yystates[yyk] = yynewState;
|
||||||
|
|
||||||
YY_RESERVE_GLRSTACK (yystackp);
|
YY_RESERVE_GLRSTACK (yystackp);
|
||||||
@@ -1369,7 +1380,7 @@ yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
|
|||||||
* for userAction. */
|
* for userAction. */
|
||||||
static inline YYRESULTTAG
|
static inline YYRESULTTAG
|
||||||
yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
||||||
YYSTYPE* yyvalp, YYLTYPE* yylocp]b4_user_formals[)
|
YYSTYPE* yyvalp]b4_locuser_formals[)
|
||||||
{
|
{
|
||||||
int yynrhs = yyrhsLength (yyrule);
|
int yynrhs = yyrhsLength (yyrule);
|
||||||
|
|
||||||
@@ -1381,8 +1392,8 @@ yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
|||||||
yystackp->yynextFree -= yynrhs;
|
yystackp->yynextFree -= yynrhs;
|
||||||
yystackp->yyspaceLeft += yynrhs;
|
yystackp->yyspaceLeft += yynrhs;
|
||||||
yystackp->yytops.yystates[0] = & yystackp->yynextFree[-1].yystate;
|
yystackp->yytops.yystates[0] = & yystackp->yynextFree[-1].yystate;
|
||||||
return yyuserAction (yyrule, yynrhs, rhs,
|
return yyuserAction (yyrule, yynrhs, rhs, yystackp,
|
||||||
yyvalp, yylocp, yystackp]b4_user_args[);
|
yyvalp]b4_locuser_args[);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1406,7 +1417,7 @@ yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
|||||||
yyupdateSplit (yystackp, yys);
|
yyupdateSplit (yystackp, yys);
|
||||||
yystackp->yytops.yystates[yyk] = yys;
|
yystackp->yytops.yystates[yyk] = yys;
|
||||||
return yyuserAction (yyrule, yynrhs, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
|
return yyuserAction (yyrule, yynrhs, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
|
||||||
yyvalp, yylocp, yystackp]b4_user_args[);
|
yystackp, yyvalp]b4_locuser_args[);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1425,7 +1436,7 @@ do { \
|
|||||||
|
|
||||||
/*ARGSUSED*/ static inline void
|
/*ARGSUSED*/ static inline void
|
||||||
yy_reduce_print (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
yy_reduce_print (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
||||||
YYSTYPE* yyvalp, YYLTYPE* yylocp]b4_user_formals[)
|
YYSTYPE* yyvalp]b4_locuser_formals[)
|
||||||
{
|
{
|
||||||
int yynrhs = yyrhsLength (yyrule);
|
int yynrhs = yyrhsLength (yyrule);
|
||||||
yybool yynormal __attribute__ ((__unused__)) =
|
yybool yynormal __attribute__ ((__unused__)) =
|
||||||
@@ -1433,8 +1444,8 @@ yy_reduce_print (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
|||||||
yyGLRStackItem* yyvsp = (yyGLRStackItem*) yystackp->yytops.yystates[yyk];
|
yyGLRStackItem* yyvsp = (yyGLRStackItem*) yystackp->yytops.yystates[yyk];
|
||||||
int yylow = 1;
|
int yylow = 1;
|
||||||
int yyi;
|
int yyi;
|
||||||
YYUSE (yyvalp);
|
YYUSE (yyvalp);]b4_locations_if([
|
||||||
YYUSE (yylocp);
|
YYUSE (yylocp);])[
|
||||||
]b4_parse_param_use[]dnl
|
]b4_parse_param_use[]dnl
|
||||||
[ YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n",
|
[ YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n",
|
||||||
(unsigned long int) yyk, yyrule - 1,
|
(unsigned long int) yyk, yyrule - 1,
|
||||||
@@ -1471,17 +1482,16 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
|||||||
|
|
||||||
if (yyforceEval || yystackp->yysplitPoint == YY_NULL)
|
if (yyforceEval || yystackp->yysplitPoint == YY_NULL)
|
||||||
{
|
{
|
||||||
YYSTYPE yysval;
|
YYSTYPE yysval;]b4_locations_if([
|
||||||
YYLTYPE yyloc;
|
YYLTYPE yyloc;])[
|
||||||
|
|
||||||
YY_REDUCE_PRINT ((yystackp, yyk, yyrule, &yysval, &yyloc]b4_user_args[));
|
YY_REDUCE_PRINT ((yystackp, yyk, yyrule, &yysval]b4_locuser_args([&yyloc])[));
|
||||||
YYCHK (yydoAction (yystackp, yyk, yyrule, &yysval,
|
YYCHK (yydoAction (yystackp, yyk, yyrule, &yysval]b4_locuser_args([&yyloc])[));
|
||||||
&yyloc]b4_user_args[));
|
|
||||||
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyrule], &yysval, &yyloc);
|
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyrule], &yysval, &yyloc);
|
||||||
yyglrShift (yystackp, yyk,
|
yyglrShift (yystackp, yyk,
|
||||||
yyLRgotoState (yystackp->yytops.yystates[yyk]->yylrState,
|
yyLRgotoState (yystackp->yytops.yystates[yyk]->yylrState,
|
||||||
yylhsNonterm (yyrule)),
|
yylhsNonterm (yyrule)),
|
||||||
yyposn, &yysval, &yyloc);
|
yyposn, &yysval]b4_locations_if([, &yyloc])[);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1699,13 +1709,13 @@ yyresolveStates (yyGLRState* yys, int yyn,
|
|||||||
* semantic values if invoked). */
|
* semantic values if invoked). */
|
||||||
static YYRESULTTAG
|
static YYRESULTTAG
|
||||||
yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystackp,
|
yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystackp,
|
||||||
YYSTYPE* yyvalp, YYLTYPE* yylocp]b4_user_formals[)
|
YYSTYPE* yyvalp]b4_locuser_formals[)
|
||||||
{
|
{
|
||||||
yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1];
|
yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1];
|
||||||
int yynrhs;
|
int yynrhs;
|
||||||
int yychar_current;
|
int yychar_current;
|
||||||
YYSTYPE yylval_current;
|
YYSTYPE yylval_current;]b4_locations_if([
|
||||||
YYLTYPE yylloc_current;
|
YYLTYPE yylloc_current;])[
|
||||||
YYRESULTTAG yyflag;
|
YYRESULTTAG yyflag;
|
||||||
|
|
||||||
yynrhs = yyrhsLength (yyopt->yyrule);
|
yynrhs = yyrhsLength (yyopt->yyrule);
|
||||||
@@ -1723,17 +1733,17 @@ yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystackp,
|
|||||||
/* Set default location. */
|
/* Set default location. */
|
||||||
yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yyopt->yystate->yyloc;]])[
|
yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yyopt->yystate->yyloc;]])[
|
||||||
yychar_current = yychar;
|
yychar_current = yychar;
|
||||||
yylval_current = yylval;
|
yylval_current = yylval;]b4_locations_if([
|
||||||
yylloc_current = yylloc;
|
yylloc_current = yylloc;])[
|
||||||
yychar = yyopt->yyrawchar;
|
yychar = yyopt->yyrawchar;
|
||||||
yylval = yyopt->yyval;
|
yylval = yyopt->yyval;]b4_locations_if([
|
||||||
yylloc = yyopt->yyloc;
|
yylloc = yyopt->yyloc;])[
|
||||||
yyflag = yyuserAction (yyopt->yyrule, yynrhs,
|
yyflag = yyuserAction (yyopt->yyrule, yynrhs,
|
||||||
yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
|
yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
|
||||||
yyvalp, yylocp, yystackp]b4_user_args[);
|
yystackp, yyvalp]b4_locuser_args[);
|
||||||
yychar = yychar_current;
|
yychar = yychar_current;
|
||||||
yylval = yylval_current;
|
yylval = yylval_current;]b4_locations_if([
|
||||||
yylloc = yylloc_current;
|
yylloc = yylloc_current;])[
|
||||||
return yyflag;
|
return yyflag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1873,15 +1883,13 @@ static YYRESULTTAG
|
|||||||
yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
|
yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
|
||||||
{
|
{
|
||||||
yySemanticOption* yyoptionList = yys->yysemantics.yyfirstVal;
|
yySemanticOption* yyoptionList = yys->yysemantics.yyfirstVal;
|
||||||
yySemanticOption* yybest;
|
yySemanticOption* yybest = yyoptionList;
|
||||||
yySemanticOption** yypp;
|
yySemanticOption** yypp;
|
||||||
yybool yymerge;
|
yybool yymerge = yyfalse;
|
||||||
YYSTYPE yysval;
|
YYSTYPE yysval;
|
||||||
YYRESULTTAG yyflag;
|
YYRESULTTAG yyflag;]b4_locations_if([
|
||||||
YYLTYPE *yylocp = &yys->yyloc;
|
YYLTYPE *yylocp = &yys->yyloc;])[
|
||||||
|
|
||||||
yybest = yyoptionList;
|
|
||||||
yymerge = yyfalse;
|
|
||||||
for (yypp = &yyoptionList->yynext; *yypp != YY_NULL; )
|
for (yypp = &yyoptionList->yynext; *yypp != YY_NULL; )
|
||||||
{
|
{
|
||||||
yySemanticOption* yyp = *yypp;
|
yySemanticOption* yyp = *yypp;
|
||||||
@@ -1922,22 +1930,20 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
{
|
{
|
||||||
yySemanticOption* yyp;
|
yySemanticOption* yyp;
|
||||||
int yyprec = yydprec[yybest->yyrule];
|
int yyprec = yydprec[yybest->yyrule];
|
||||||
yyflag = yyresolveAction (yybest, yystackp, &yysval,
|
yyflag = yyresolveAction (yybest, yystackp, &yysval]b4_locuser_args[);
|
||||||
yylocp]b4_user_args[);
|
|
||||||
if (yyflag == yyok)
|
if (yyflag == yyok)
|
||||||
for (yyp = yybest->yynext; yyp != YY_NULL; yyp = yyp->yynext)
|
for (yyp = yybest->yynext; yyp != YY_NULL; yyp = yyp->yynext)
|
||||||
{
|
{
|
||||||
if (yyprec == yydprec[yyp->yyrule])
|
if (yyprec == yydprec[yyp->yyrule])
|
||||||
{
|
{
|
||||||
YYSTYPE yysval_other;
|
YYSTYPE yysval_other;]b4_locations_if([
|
||||||
YYLTYPE yydummy;
|
YYLTYPE yydummy;])[
|
||||||
yyflag = yyresolveAction (yyp, yystackp, &yysval_other,
|
yyflag = yyresolveAction (yyp, yystackp, &yysval_other]b4_locuser_args([&yydummy])[);
|
||||||
&yydummy]b4_user_args[);
|
|
||||||
if (yyflag != yyok)
|
if (yyflag != yyok)
|
||||||
{
|
{
|
||||||
yydestruct ("Cleanup: discarding incompletely merged value for",
|
yydestruct ("Cleanup: discarding incompletely merged value for",
|
||||||
yystos[yys->yylrState],
|
yystos[yys->yylrState],
|
||||||
&yysval]b4_locations_if([, yylocp])[]b4_user_args[);
|
&yysval]b4_locuser_args[);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
yyuserMerge (yymerger[yyp->yyrule], &yysval, &yysval_other);
|
yyuserMerge (yymerger[yyp->yyrule], &yysval, &yysval_other);
|
||||||
@@ -1945,7 +1951,7 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
yyflag = yyresolveAction (yybest, yystackp, &yysval, yylocp]b4_user_args[);
|
yyflag = yyresolveAction (yybest, yystackp, &yysval]b4_locuser_args([yylocp])[);
|
||||||
|
|
||||||
if (yyflag == yyok)
|
if (yyflag == yyok)
|
||||||
{
|
{
|
||||||
@@ -2243,7 +2249,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
YYLLOC_DEFAULT ((yys->yyloc), yyerror_range, 2);]])[
|
YYLLOC_DEFAULT ((yys->yyloc), yyerror_range, 2);]])[
|
||||||
yytoken = YYTRANSLATE (yychar);
|
yytoken = YYTRANSLATE (yychar);
|
||||||
yydestruct ("Error: discarding",
|
yydestruct ("Error: discarding",
|
||||||
yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
|
yytoken, &yylval]b4_locuser_args([&yylloc])[);
|
||||||
}
|
}
|
||||||
YYDPRINTF ((stderr, "Reading a token: "));
|
YYDPRINTF ((stderr, "Reading a token: "));
|
||||||
yychar = YYLEX;
|
yychar = YYLEX;
|
||||||
@@ -2293,19 +2299,20 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR
|
if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR
|
||||||
&& yyisShiftAction (yytable[yyj]))
|
&& yyisShiftAction (yytable[yyj]))
|
||||||
{
|
{
|
||||||
/* Shift the error token having adjusted its location. */
|
/* Shift the error token. */]b4_locations_if([[
|
||||||
YYLTYPE yyerrloc;]b4_locations_if([[
|
/* First adjust its location.*/
|
||||||
|
YYLTYPE yyerrloc;
|
||||||
yystackp->yyerror_range[2].yystate.yyloc = yylloc;
|
yystackp->yyerror_range[2].yystate.yyloc = yylloc;
|
||||||
YYLLOC_DEFAULT (yyerrloc, (yystackp->yyerror_range), 2);]])[
|
YYLLOC_DEFAULT (yyerrloc, (yystackp->yyerror_range), 2);]])[
|
||||||
YY_SYMBOL_PRINT ("Shifting", yystos[yytable[yyj]],
|
YY_SYMBOL_PRINT ("Shifting", yystos[yytable[yyj]],
|
||||||
&yylval, &yyerrloc);
|
&yylval, &yyerrloc);
|
||||||
yyglrShift (yystackp, 0, yytable[yyj],
|
yyglrShift (yystackp, 0, yytable[yyj],
|
||||||
yys->yyposn, &yylval, &yyerrloc);
|
yys->yyposn, &yylval]b4_locations_if([, &yyerrloc])[);
|
||||||
yys = yystackp->yytops.yystates[0];
|
yys = yystackp->yytops.yystates[0];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}]b4_locations_if([[
|
||||||
]b4_locations_if([[ yystackp->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
|
yystackp->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
|
||||||
if (yys->yypred != YY_NULL)
|
if (yys->yypred != YY_NULL)
|
||||||
yydestroyGLRState ("Error: popping", yys]b4_user_args[);
|
yydestroyGLRState ("Error: popping", yys]b4_user_args[);
|
||||||
yystackp->yytops.yystates[0] = yys->yypred;
|
yystackp->yytops.yystates[0] = yys->yypred;
|
||||||
@@ -2371,7 +2378,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
case 2: goto yyexhaustedlab;
|
case 2: goto yyexhaustedlab;
|
||||||
default: goto yybuglab;
|
default: goto yybuglab;
|
||||||
}
|
}
|
||||||
yyglrShift (&yystack, 0, 0, 0, &yylval, &yylloc);
|
yyglrShift (&yystack, 0, 0, 0, &yylval]b4_locations_if([, &yylloc])[);
|
||||||
yyposn = 0;
|
yyposn = 0;
|
||||||
|
|
||||||
while (YYID (yytrue))
|
while (YYID (yytrue))
|
||||||
@@ -2429,7 +2436,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
|
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
|
||||||
yychar = YYEMPTY;
|
yychar = YYEMPTY;
|
||||||
yyposn += 1;
|
yyposn += 1;
|
||||||
yyglrShift (&yystack, 0, yyaction, yyposn, &yylval, &yylloc);
|
yyglrShift (&yystack, 0, yyaction, yyposn, &yylval]b4_locations_if([, &yylloc])[);
|
||||||
if (0 < yystack.yyerrState)
|
if (0 < yystack.yyerrState)
|
||||||
yystack.yyerrState -= 1;
|
yystack.yyerrState -= 1;
|
||||||
}
|
}
|
||||||
@@ -2505,7 +2512,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
YYDPRINTF ((stderr, "On stack %lu, ", (unsigned long int) yys));
|
YYDPRINTF ((stderr, "On stack %lu, ", (unsigned long int) yys));
|
||||||
YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc);
|
YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc);
|
||||||
yyglrShift (&yystack, yys, yyaction, yyposn,
|
yyglrShift (&yystack, yys, yyaction, yyposn,
|
||||||
&yylval, &yylloc);
|
&yylval]b4_locations_if([, &yylloc])[);
|
||||||
YYDPRINTF ((stderr, "Stack %lu now in state #%d\n",
|
YYDPRINTF ((stderr, "Stack %lu now in state #%d\n",
|
||||||
(unsigned long int) yys,
|
(unsigned long int) yys,
|
||||||
yystack.yytops.yystates[yys]->yylrState));
|
yystack.yytops.yystates[yys]->yylrState));
|
||||||
@@ -2545,8 +2552,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
yyreturn:
|
yyreturn:
|
||||||
if (yychar != YYEMPTY)
|
if (yychar != YYEMPTY)
|
||||||
yydestruct ("Cleanup: discarding lookahead",
|
yydestruct ("Cleanup: discarding lookahead",
|
||||||
YYTRANSLATE (yychar),
|
YYTRANSLATE (yychar), &yylval]b4_locuser_args([&yylloc])[);
|
||||||
&yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
|
|
||||||
|
|
||||||
/* If the stack is well-formed, pop the stack until it is empty,
|
/* If the stack is well-formed, pop the stack until it is empty,
|
||||||
destroying its entries as we go. But free the stack regardless
|
destroying its entries as we go. But free the stack regardless
|
||||||
|
|||||||
Reference in New Issue
Block a user