summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorAdrian Vogelsgesang <avogelsgesang@tableau.com>2019-07-13 12:42:48 +0200
committerAkim Demaille <akim.demaille@gmail.com>2019-08-09 06:06:02 -0500
commit996abe62d73698bf31d49f0f9a73fdefd5c820c4 (patch)
tree0b694b1f9790beff1def676cd888aa9ac95e093b /data
parent0420362ee8aa975efa36494fe20502dfc6bafe0e (diff)
downloadbison-996abe62d73698bf31d49f0f9a73fdefd5c820c4.tar.gz
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.
Diffstat (limited to 'data')
-rw-r--r--data/skeletons/yacc.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c
index e9c31a84..54dc6ea1 100644
--- a/data/skeletons/yacc.c
+++ b/data/skeletons/yacc.c
@@ -1188,15 +1188,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
YYDPRINTF ((stderr, "Constructing syntax error message\n"));]])[
yyarg[yycount++] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
- {]b4_lac_if([], [[
- /* 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;]b4_lac_if([[
+ {]b4_lac_if([[
+ int yyx;
for (yyx = 0; yyx < YYNTOKENS; ++yyx)
if (yyx != YYTERROR && yyx != YYUNDEFTOK)
@@ -1209,6 +1202,14 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
if (yy_lac_status == 1)
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)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR