mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 16:53:02 +00:00
style: readability improvements to yacc.c
* data/skeletons/yacc.c (yysyntax_error): Change the nesting of `m4` conditions slightly to make it more readable. The generated C code stays unchanged.
This commit is contained in:
committed by
Akim Demaille
parent
0420362ee8
commit
996abe62d7
@@ -1188,15 +1188,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
YYDPRINTF ((stderr, "Constructing syntax error message\n"));]])[
|
YYDPRINTF ((stderr, "Constructing syntax error message\n"));]])[
|
||||||
yyarg[yycount++] = yytname[yytoken];
|
yyarg[yycount++] = yytname[yytoken];
|
||||||
if (!yypact_value_is_default (yyn))
|
if (!yypact_value_is_default (yyn))
|
||||||
{]b4_lac_if([], [[
|
{]b4_lac_if([[
|
||||||
/* Start YYX at -YYN if negative to avoid negative indexes in
|
int yyx;
|
||||||
YYCHECK. In other words, skip the first -YYN actions for
|
|
||||||
this state because they are default actions. */
|
|
||||||
int yyxbegin = yyn < 0 ? -yyn : 0;
|
|
||||||
/* Stay within bounds of both yycheck and yytname. */
|
|
||||||
int yychecklim = YYLAST - yyn + 1;
|
|
||||||
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;]])[
|
|
||||||
int yyx;]b4_lac_if([[
|
|
||||||
|
|
||||||
for (yyx = 0; yyx < YYNTOKENS; ++yyx)
|
for (yyx = 0; yyx < YYNTOKENS; ++yyx)
|
||||||
if (yyx != YYTERROR && yyx != YYUNDEFTOK)
|
if (yyx != YYTERROR && yyx != YYUNDEFTOK)
|
||||||
@@ -1209,6 +1202,14 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
if (yy_lac_status == 1)
|
if (yy_lac_status == 1)
|
||||||
continue;
|
continue;
|
||||||
}]], [[
|
}]], [[
|
||||||
|
/* Start YYX at -YYN if negative to avoid negative indexes in
|
||||||
|
YYCHECK. In other words, skip the first -YYN actions for
|
||||||
|
this state because they are default actions. */
|
||||||
|
int yyxbegin = yyn < 0 ? -yyn : 0;
|
||||||
|
/* Stay within bounds of both yycheck and yytname. */
|
||||||
|
int yychecklim = YYLAST - yyn + 1;
|
||||||
|
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
||||||
|
int yyx;
|
||||||
|
|
||||||
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
|
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
|
||||||
|
|||||||
Reference in New Issue
Block a user