* data/glr.c (yy_reduce_print): The loop was quite wrong: type are

from 1 to N, while values and location start at 0.
(b4_rhs_location, b4_rhs_value): Add parens around $1 and $2.
This commit is contained in:
Akim Demaille
2005-11-14 17:20:28 +00:00
parent a1373f559a
commit 6de5398de3
2 changed files with 11 additions and 6 deletions

View File

@@ -1,3 +1,9 @@
2005-11-14 Akim Demaille <akim@epita.fr>
* data/glr.c (yy_reduce_print): The loop was quite wrong: type are
from 1 to N, while values and location start at 0.
(b4_rhs_location, b4_rhs_value): Add parens around $1 and $2.
2005-11-14 Akim Demaille <akim@epita.fr>
* data/glr.c (yy_reduce_print): Fix the $ number.

View File

@@ -116,7 +116,7 @@ m4_define([b4_lhs_value],
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
# symbols on RHS.
m4_define([b4_rhs_value],
[(((yyGLRStackItem const *)yyvsp)@{YYFILL ($2 - $1)@}.yystate.yysemantics.yysval[]m4_ifval([$3], [.$3]))])
[(((yyGLRStackItem const *)yyvsp)@{YYFILL (($2) - ($1))@}.yystate.yysemantics.yysval[]m4_ifval([$3], [.$3]))])
@@ -136,7 +136,7 @@ m4_define([b4_lhs_location],
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
# on RHS.
m4_define([b4_rhs_location],
[(((yyGLRStackItem const *)yyvsp)@{YYFILL ($2 - $1)@}.yystate.yyloc)])
[(((yyGLRStackItem const *)yyvsp)@{YYFILL (($2) - ($1))@}.yystate.yyloc)])
@@ -1382,14 +1382,13 @@ yy_reduce_print (yyGLRStack* yystack, size_t yyk, yyRuleNum yyrule,
[ YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n",
(unsigned long int) yyk, yyrule - 1,
(unsigned long int) yyrline[yyrule]);
/* Print the symbols being reduced, and their result. */
//for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
fprintf (stderr, " $%d = ", yyi + 1);
yysymprint (stderr, yyrhs[yyprhs[yyrule] + yyi],
&]b4_rhs_value(yynrhs, yyi)[
]b4_location_if([, &]b4_rhs_location(yynrhs, yyi))[]dnl
&]b4_rhs_value(yynrhs, yyi - 1)[
]b4_location_if([, &]b4_rhs_location(yynrhs, yyi - 1))[]dnl
b4_user_args[);
fprintf (stderr, "\n");
}