mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
(yydestroyStackItem): New function.
(yyrecoverSyntaxError, yyreturn): Use it to improve quality of debugging information. Problem reported by Joel E. Denny.
This commit is contained in:
30
data/glr.c
30
data/glr.c
@@ -886,6 +886,26 @@ yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
|
||||
|
||||
]b4_yydestruct_generate([b4_c_ansi_function_def])[
|
||||
|
||||
static void
|
||||
yydestroyStackItem (char const *yymsg, yyGLRState *yys)
|
||||
{
|
||||
if (yys->yyresolved)
|
||||
yydestruct (yymsg, yystos[yys->yylrState],
|
||||
&yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[);
|
||||
else
|
||||
{
|
||||
#if YYDEBUG
|
||||
if (yydebug)
|
||||
{
|
||||
YYFPRINTF (stderr, "%s unresolved ", yymsg);
|
||||
yysymprint (stderr, yystos[yys->yylrState],
|
||||
&yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[);
|
||||
YYFPRINTF (stderr, "\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/** Number of symbols composing the right hand side of rule #RULE. */
|
||||
static inline int
|
||||
yyrhsLength (yyRuleNum yyrule)
|
||||
@@ -1981,10 +2001,7 @@ yyrecoverSyntaxError (yyGLRStack* yystack,
|
||||
}
|
||||
}
|
||||
]b4_location_if([[ yystack->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
|
||||
if (yys->yyresolved)
|
||||
yydestruct ("Error: popping",
|
||||
yystos[yys->yylrState],
|
||||
&yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[);
|
||||
yydestroyStackItem ("Error: popping", yys);
|
||||
yystack->yytops.yystates[0] = yys->yypred;
|
||||
yystack->yynextFree -= 1;
|
||||
yystack->yyspaceLeft += 1;
|
||||
@@ -2184,10 +2201,7 @@ b4_syncline([@oline@], [@ofile@])])dnl
|
||||
{
|
||||
yyGLRState *yys = yystates[0];
|
||||
]b4_location_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]]
|
||||
)[ if (yys->yyresolved)
|
||||
yydestruct ("Cleanup: popping",
|
||||
yystos[yys->yylrState],
|
||||
&yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[);
|
||||
)[ yydestroyStackItem ("Cleanup: popping", yys);
|
||||
yystates[0] = yys->yypred;
|
||||
yystack.yynextFree -= 1;
|
||||
yystack.yyspaceLeft += 1;
|
||||
|
||||
Reference in New Issue
Block a user