mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 01:33:03 +00:00
glr: simplify the invocation of YYLLOC_DEFAULT
The commit which introduces yyresolveLocations (commit
8710fc41aa) saves and restores the
look-ahead (type, value and location) for no clear reason. This
appears to be useless.
* data/glr.c (yyresolveLocations): Don't save/restore the current
look-ahead to call YYLLOC_DEFAULT.
Minor style changes.
This commit is contained in:
19
data/glr.c
19
data/glr.c
@@ -1661,7 +1661,7 @@ yyreportAmbiguity (yySemanticOption* yyx0,
|
|||||||
* ending at YYS1. Has no effect on previously resolved states.
|
* ending at YYS1. Has no effect on previously resolved states.
|
||||||
* The first semantic option of a state is always chosen. */
|
* The first semantic option of a state is always chosen. */
|
||||||
static void
|
static void
|
||||||
yyresolveLocations (yyGLRState* yys1, int yyn1,
|
yyresolveLocations (yyGLRState *yys1, int yyn1,
|
||||||
yyGLRStack *yystackp]b4_user_formals[)
|
yyGLRStack *yystackp]b4_user_formals[)
|
||||||
{
|
{
|
||||||
if (0 < yyn1)
|
if (0 < yyn1)
|
||||||
@@ -1672,9 +1672,9 @@ yyresolveLocations (yyGLRState* yys1, int yyn1,
|
|||||||
yyGLRStackItem yyrhsloc[1 + YYMAXRHS];
|
yyGLRStackItem yyrhsloc[1 + YYMAXRHS];
|
||||||
int yynrhs;
|
int yynrhs;
|
||||||
yySemanticOption *yyoption = yys1->yysemantics.yyfirstVal;
|
yySemanticOption *yyoption = yys1->yysemantics.yyfirstVal;
|
||||||
YYASSERT (yyoption != YY_NULL);
|
YYASSERT (yyoption);
|
||||||
yynrhs = yyrhsLength (yyoption->yyrule);
|
yynrhs = yyrhsLength (yyoption->yyrule);
|
||||||
if (yynrhs > 0)
|
if (0 < yynrhs)
|
||||||
{
|
{
|
||||||
yyGLRState *yys;
|
yyGLRState *yys;
|
||||||
int yyn;
|
int yyn;
|
||||||
@@ -1697,18 +1697,7 @@ yyresolveLocations (yyGLRState* yys1, int yyn1,
|
|||||||
yyGLRState *yyprevious = yyoption->yystate;
|
yyGLRState *yyprevious = yyoption->yystate;
|
||||||
yyrhsloc[0].yystate.yyloc = yyprevious->yyloc;
|
yyrhsloc[0].yystate.yyloc = yyprevious->yyloc;
|
||||||
}
|
}
|
||||||
{
|
YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs);
|
||||||
int yychar_current = yychar;
|
|
||||||
YYSTYPE yylval_current = yylval;
|
|
||||||
YYLTYPE yylloc_current = yylloc;
|
|
||||||
yychar = yyoption->yyrawchar;
|
|
||||||
yylval = yyoption->yyval;
|
|
||||||
yylloc = yyoption->yyloc;
|
|
||||||
YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs);
|
|
||||||
yychar = yychar_current;
|
|
||||||
yylval = yylval_current;
|
|
||||||
yylloc = yylloc_current;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}]])[
|
}]])[
|
||||||
|
|||||||
Reference in New Issue
Block a user