Hi,

the debugging function yy_reduce_print in the Java parser
used a wrong index for the state resulting in a less mean-
ingful output.  The attached patch fixes this.

Tim
>From e75104f018bb55e32335e16535a40c90af55a780 Mon Sep 17 00:00:00 2001
From: Tim Landscheidt <[email protected]>
Date: Sun, 8 Jan 2012 01:17:56 +0000
Subject: [PATCH] Fix wrong state index used in Java parser's `yy_reduce_print'.

---
 data/lalr1.java |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/data/lalr1.java b/data/lalr1.java
index 9aa4b4f..14aa05d 100644
--- a/data/lalr1.java
+++ b/data/lalr1.java
@@ -848,7 +848,7 @@ m4_popdef([b4_at_dollar])])dnl
     /* The symbols being reduced.  */
     for (int yyi = 0; yyi < yynrhs; yyi++)
       yy_symbol_print ("   $" + (yyi + 1) + " =",
-                       yystos_[yystack.stateAt(yyi + 1 - yynrhs)],
+                       yystos_[yystack.stateAt(yynrhs - (yyi + 1))],
                        ]b4_rhs_value(yynrhs, yyi + 1)b4_locations_if([,
                        b4_rhs_location(yynrhs, yyi + 1)])[);
   }
-- 
1.6.2.5

Reply via email to