mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
yacc.c: style: prefer switch to if
* data/skeletons/yacc.c: Prefer switch to decode yy_lac's return value.
This commit is contained in:
@@ -960,23 +960,22 @@ yy_lac_stack_realloc (YYPTRDIFF_T *yycapacity, YYPTRDIFF_T yyadd,
|
|||||||
current lookahead, then check if that lookahead can eventually be
|
current lookahead, then check if that lookahead can eventually be
|
||||||
shifted if syntactic actions continue from the current context.
|
shifted if syntactic actions continue from the current context.
|
||||||
Report a syntax error if it cannot. */
|
Report a syntax error if it cannot. */
|
||||||
#define YY_LAC_ESTABLISH \
|
#define YY_LAC_ESTABLISH \
|
||||||
do { \
|
do { \
|
||||||
if (!yy_lac_established) \
|
if (!yy_lac_established) \
|
||||||
{ \
|
{ \
|
||||||
YYDPRINTF ((stderr, \
|
YYDPRINTF ((stderr, \
|
||||||
"LAC: initial context established for %s\n", \
|
"LAC: initial context established for %s\n", \
|
||||||
yysymbol_name (yytoken))); \
|
yysymbol_name (yytoken))); \
|
||||||
yy_lac_established = 1; \
|
yy_lac_established = 1; \
|
||||||
{ \
|
switch (yy_lac (yyesa, &yyes, &yyes_capacity, yyssp, yytoken)) \
|
||||||
int yy_lac_status = \
|
{ \
|
||||||
yy_lac (yyesa, &yyes, &yyes_capacity, yyssp, yytoken); \
|
case 2: \
|
||||||
if (yy_lac_status == 2) \
|
goto yyexhaustedlab; \
|
||||||
goto yyexhaustedlab; \
|
case 1: \
|
||||||
if (yy_lac_status == 1) \
|
goto yyerrlab; \
|
||||||
goto yyerrlab; \
|
} \
|
||||||
} \
|
} \
|
||||||
} \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* Discard any previous initial lookahead context because of Event,
|
/* Discard any previous initial lookahead context because of Event,
|
||||||
@@ -1147,23 +1146,21 @@ yyexpected_tokens (const yyparse_context_t *yyctx,
|
|||||||
int yyx;
|
int yyx;
|
||||||
for (yyx = 0; yyx < YYNTOKENS; ++yyx)
|
for (yyx = 0; yyx < YYNTOKENS; ++yyx)
|
||||||
if (yyx != YYTERROR && yyx != YYUNDEFTOK)
|
if (yyx != YYTERROR && yyx != YYUNDEFTOK)
|
||||||
{
|
switch (yy_lac (]b4_push_if([[yyps->yyesa, &yyps->yyes, &yyps->yyes_capacity, yyps->yyssp, yyx]],
|
||||||
|
[[yyctx->yyesa, yyctx->yyes, yyctx->yyes_capacity, yyctx->yyssp, yyx]])[))
|
||||||
{
|
{
|
||||||
int yy_lac_status
|
case 2:
|
||||||
= yy_lac (]b4_push_if([[yyps->yyesa, &yyps->yyes, &yyps->yyes_capacity, yyps->yyssp, yyx]],
|
return -2;
|
||||||
[[yyctx->yyesa, yyctx->yyes, yyctx->yyes_capacity, yyctx->yyssp, yyx]])[);
|
case 1:
|
||||||
if (yy_lac_status == 2)
|
continue;
|
||||||
return -2;
|
default:
|
||||||
if (yy_lac_status == 1)
|
if (!yyarg)
|
||||||
continue;
|
++yycount;
|
||||||
}
|
else if (yycount == yyargn)
|
||||||
if (!yyarg)
|
return 0;
|
||||||
++yycount;
|
else
|
||||||
else if (yycount == yyargn)
|
yyarg[yycount++] = yyx;
|
||||||
return 0;
|
}]],
|
||||||
else
|
|
||||||
yyarg[yycount++] = yyx;
|
|
||||||
}]],
|
|
||||||
[[ int yyn = yypact@{+*]b4_push_if([yyps], [yyctx])[->yyssp@};
|
[[ int yyn = yypact@{+*]b4_push_if([yyps], [yyctx])[->yyssp@};
|
||||||
if (!yypact_value_is_default (yyn))
|
if (!yypact_value_is_default (yyn))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user