mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 14:23:04 +00:00
style: reduce scopes in glr.c
* data/skeletons/glr.c (yyrecoverSyntaxError): here.
This commit is contained in:
@@ -2134,15 +2134,13 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
static void
|
static void
|
||||||
yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
||||||
{
|
{
|
||||||
size_t yyk;
|
|
||||||
int yyj;
|
|
||||||
|
|
||||||
if (yystackp->yyerrState == 3)
|
if (yystackp->yyerrState == 3)
|
||||||
/* We just shifted the error token and (perhaps) took some
|
/* We just shifted the error token and (perhaps) took some
|
||||||
reductions. Skip tokens until we can proceed. */
|
reductions. Skip tokens until we can proceed. */
|
||||||
while (yytrue)
|
while (yytrue)
|
||||||
{
|
{
|
||||||
yySymbol yytoken;
|
yySymbol yytoken;
|
||||||
|
int yyj;
|
||||||
if (yychar == YYEOF)
|
if (yychar == YYEOF)
|
||||||
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
||||||
if (yychar != YYEMPTY)
|
if (yychar != YYEMPTY)
|
||||||
@@ -2184,22 +2182,25 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Reduce to one stack. */
|
/* Reduce to one stack. */
|
||||||
for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1)
|
{
|
||||||
if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
size_t yyk;
|
||||||
break;
|
for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1)
|
||||||
if (yyk >= yystackp->yytops.yysize)
|
if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
||||||
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
break;
|
||||||
for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1)
|
if (yyk >= yystackp->yytops.yysize)
|
||||||
yymarkStackDeleted (yystackp, yyk);
|
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
||||||
yyremoveDeletes (yystackp);
|
for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1)
|
||||||
yycompressStack (yystackp);
|
yymarkStackDeleted (yystackp, yyk);
|
||||||
|
yyremoveDeletes (yystackp);
|
||||||
|
yycompressStack (yystackp);
|
||||||
|
}
|
||||||
|
|
||||||
/* Now pop stack until we find a state that shifts the error token. */
|
/* Now pop stack until we find a state that shifts the error token. */
|
||||||
yystackp->yyerrState = 3;
|
yystackp->yyerrState = 3;
|
||||||
while (yystackp->yytops.yystates[0] != YY_NULLPTR)
|
while (yystackp->yytops.yystates[0] != YY_NULLPTR)
|
||||||
{
|
{
|
||||||
yyGLRState *yys = yystackp->yytops.yystates[0];
|
yyGLRState *yys = yystackp->yytops.yystates[0];
|
||||||
yyj = yypact[yys->yylrState];
|
int yyj = yypact[yys->yylrState];
|
||||||
if (! yypact_value_is_default (yyj))
|
if (! yypact_value_is_default (yyj))
|
||||||
{
|
{
|
||||||
yyj += YYTERROR;
|
yyj += YYTERROR;
|
||||||
@@ -2287,17 +2288,13 @@ b4_dollar_popdef])[]dnl
|
|||||||
/* Standard mode */
|
/* Standard mode */
|
||||||
while (yytrue)
|
while (yytrue)
|
||||||
{
|
{
|
||||||
yyRuleNum yyrule;
|
|
||||||
int yyaction;
|
|
||||||
const short* yyconflicts;
|
|
||||||
|
|
||||||
yyStateNum yystate = yystack.yytops.yystates[0]->yylrState;
|
yyStateNum yystate = yystack.yytops.yystates[0]->yylrState;
|
||||||
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
||||||
if (yystate == YYFINAL)
|
if (yystate == YYFINAL)
|
||||||
goto yyacceptlab;
|
goto yyacceptlab;
|
||||||
if (yyisDefaultedState (yystate))
|
if (yyisDefaultedState (yystate))
|
||||||
{
|
{
|
||||||
yyrule = yydefaultAction (yystate);
|
yyRuleNum yyrule = yydefaultAction (yystate);
|
||||||
if (yyrule == 0)
|
if (yyrule == 0)
|
||||||
{]b4_locations_if([[
|
{]b4_locations_if([[
|
||||||
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
||||||
@@ -2308,6 +2305,8 @@ b4_dollar_popdef])[]dnl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
int yyaction;
|
||||||
|
const short* yyconflicts;
|
||||||
yySymbol yytoken;
|
yySymbol yytoken;
|
||||||
if (yychar == YYEMPTY)
|
if (yychar == YYEMPTY)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user