[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: glr: reduce_print fixes
From: |
Akim Demaille |
Subject: |
FYI: glr: reduce_print fixes |
Date: |
Mon, 14 Nov 2005 18:21:15 +0100 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) |
I was pretty unlucky before: it was working...
Index: ChangeLog
from Akim Demaille <address@hidden>
* 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.
Index: data/glr.c
===================================================================
RCS file: /cvsroot/bison/bison/data/glr.c,v
retrieving revision 1.138
diff -u -u -r1.138 glr.c
--- data/glr.c 14 Nov 2005 15:33:18 -0000 1.138
+++ data/glr.c 14 Nov 2005 16:53:19 -0000
@@ -116,7 +116,7 @@
# 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 @@
# 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 @@
[ 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");
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: glr: reduce_print fixes,
Akim Demaille <=