mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-21 02:03:03 +00:00
glr.c: style changes
* data/skeletons/glr.c (yysplitStack): Reduce scopes. * tests/atlocal.in: Formatting changes.
This commit is contained in:
@@ -1510,18 +1510,16 @@ yysplitStack (yyGLRStack* yystackp, ptrdiff_t yyk)
|
|||||||
YYASSERT (yyk == 0);
|
YYASSERT (yyk == 0);
|
||||||
yystackp->yysplitPoint = yystackp->yytops.yystates[yyk];
|
yystackp->yysplitPoint = yystackp->yytops.yystates[yyk];
|
||||||
}
|
}
|
||||||
if (yystackp->yytops.yysize >= yystackp->yytops.yycapacity)
|
if (yystackp->yytops.yycapacity <= yystackp->yytops.yysize)
|
||||||
{
|
{
|
||||||
yyGLRState** yynewStates = YY_NULLPTR;
|
ptrdiff_t state_size = sizeof yystackp->yytops.yystates[0];
|
||||||
yybool* yynewLookaheadNeeds;
|
|
||||||
ptrdiff_t state_size = sizeof yynewStates[0];
|
|
||||||
ptrdiff_t half_max_capacity = YYSIZEMAX / 2 / state_size;
|
ptrdiff_t half_max_capacity = YYSIZEMAX / 2 / state_size;
|
||||||
|
|
||||||
if (half_max_capacity < yystackp->yytops.yycapacity)
|
if (half_max_capacity < yystackp->yytops.yycapacity)
|
||||||
yyMemoryExhausted (yystackp);
|
yyMemoryExhausted (yystackp);
|
||||||
yystackp->yytops.yycapacity *= 2;
|
yystackp->yytops.yycapacity *= 2;
|
||||||
|
|
||||||
yynewStates
|
{
|
||||||
|
yyGLRState** yynewStates
|
||||||
= YY_CAST (yyGLRState**,
|
= YY_CAST (yyGLRState**,
|
||||||
YYREALLOC (yystackp->yytops.yystates,
|
YYREALLOC (yystackp->yytops.yystates,
|
||||||
(YY_CAST (size_t, yystackp->yytops.yycapacity)
|
(YY_CAST (size_t, yystackp->yytops.yycapacity)
|
||||||
@@ -1529,8 +1527,10 @@ yysplitStack (yyGLRStack* yystackp, ptrdiff_t yyk)
|
|||||||
if (yynewStates == YY_NULLPTR)
|
if (yynewStates == YY_NULLPTR)
|
||||||
yyMemoryExhausted (yystackp);
|
yyMemoryExhausted (yystackp);
|
||||||
yystackp->yytops.yystates = yynewStates;
|
yystackp->yytops.yystates = yynewStates;
|
||||||
|
}
|
||||||
|
|
||||||
yynewLookaheadNeeds
|
{
|
||||||
|
yybool* yynewLookaheadNeeds
|
||||||
= YY_CAST (yybool*,
|
= YY_CAST (yybool*,
|
||||||
YYREALLOC (yystackp->yytops.yylookaheadNeeds,
|
YYREALLOC (yystackp->yytops.yylookaheadNeeds,
|
||||||
(YY_CAST (size_t, yystackp->yytops.yycapacity)
|
(YY_CAST (size_t, yystackp->yytops.yycapacity)
|
||||||
@@ -1539,12 +1539,13 @@ yysplitStack (yyGLRStack* yystackp, ptrdiff_t yyk)
|
|||||||
yyMemoryExhausted (yystackp);
|
yyMemoryExhausted (yystackp);
|
||||||
yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds;
|
yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
yystackp->yytops.yystates[yystackp->yytops.yysize]
|
yystackp->yytops.yystates[yystackp->yytops.yysize]
|
||||||
= yystackp->yytops.yystates[yyk];
|
= yystackp->yytops.yystates[yyk];
|
||||||
yystackp->yytops.yylookaheadNeeds[yystackp->yytops.yysize]
|
yystackp->yytops.yylookaheadNeeds[yystackp->yytops.yysize]
|
||||||
= yystackp->yytops.yylookaheadNeeds[yyk];
|
= yystackp->yytops.yylookaheadNeeds[yyk];
|
||||||
yystackp->yytops.yysize += 1;
|
yystackp->yytops.yysize += 1;
|
||||||
return yystackp->yytops.yysize-1;
|
return yystackp->yytops.yysize - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** True iff YYY0 and YYY1 represent identical options at the top level.
|
/** True iff YYY0 and YYY1 represent identical options at the top level.
|
||||||
@@ -1578,7 +1579,7 @@ yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1)
|
|||||||
int yyn;
|
int yyn;
|
||||||
for (yys0 = yyy0->yystate, yys1 = yyy1->yystate,
|
for (yys0 = yyy0->yystate, yys1 = yyy1->yystate,
|
||||||
yyn = yyrhsLength (yyy0->yyrule);
|
yyn = yyrhsLength (yyy0->yyrule);
|
||||||
yyn > 0;
|
0 < yyn;
|
||||||
yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1)
|
yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1)
|
||||||
{
|
{
|
||||||
if (yys0 == yys1)
|
if (yys0 == yys1)
|
||||||
|
|||||||
Reference in New Issue
Block a user