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:
Akim Demaille
2020-03-17 19:11:53 +01:00
parent 44ac18d136
commit cbb967dbad

View File

@@ -968,12 +968,11 @@ do { \
"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 = \ case 2: \
yy_lac (yyesa, &yyes, &yyes_capacity, yyssp, yytoken); \
if (yy_lac_status == 2) \
goto yyexhaustedlab; \ goto yyexhaustedlab; \
if (yy_lac_status == 1) \ case 1: \
goto yyerrlab; \ goto yyerrlab; \
} \ } \
} \ } \
@@ -1147,16 +1146,14 @@ 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]])[))
{ {
{ case 2:
int yy_lac_status
= 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]])[);
if (yy_lac_status == 2)
return -2; return -2;
if (yy_lac_status == 1) case 1:
continue; continue;
} default:
if (!yyarg) if (!yyarg)
++yycount; ++yycount;
else if (yycount == yyargn) else if (yycount == yyargn)