java: fix location handling bug.
authorBernd Kiefer <kiefer@dfki.de>
Sun, 20 Feb 2011 00:24:07 +0000 (19:24 -0500)
committerJoel E. Denny <joeldenny@joeldenny.org>
Sun, 20 Feb 2011 00:46:54 +0000 (19:46 -0500)
Reported at
<http://lists.gnu.org/archive/html/bison-patches/2011-02/msg00005.html>.
* data/lalr1.java (YYParser::yylloc): For non-empty RHS, fix
reversed access to location stack.
* THANKS (Bernd Kiefer): Add.

ChangeLog
THANKS
data/lalr1.java

index 51deb00..df1d6ec 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-02-19  Bernd Kiefer  <kiefer@dfki.de>  (tiny change)
+
+       java: fix location handling bug.
+       Reported at
+       <http://lists.gnu.org/archive/html/bison-patches/2011-02/msg00005.html>.
+       * data/lalr1.java (YYParser::yylloc): For non-empty RHS, fix
+       reversed access to location stack.
+       * THANKS (Bernd Kiefer): Add.
+
 2010-05-11  Akim Demaille  <demaille@gostai.com>
 
        doc: please Emacs.
diff --git a/THANKS b/THANKS
index e4354d7..43acbed 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -13,6 +13,7 @@ Arnold Robbins            arnold@skeeve.com
 Art Haas                  ahaas@neosoft.com
 Baron Schwartz            baron@sequent.org
 Benoit Perrot             benoit.perrot@epita.fr
+Bernd Kiefer              kiefer@dfki.de
 Bert Deknuydt             Bert.Deknuydt@esat.kuleuven.ac.be
 Bill Allombert            Bill.Allombert@math.u-bordeaux1.fr
 Bob Rossi                 bob@brasko.net
index 1533e37..aad54a3 100644 (file)
@@ -102,7 +102,7 @@ b4_token_enums(b4_tokens)
   private ]b4_location_type[ yylloc (YYStack rhs, int n)
   {
     if (n > 0)
-      return new ]b4_location_type[ (rhs.locationAt (1).begin, rhs.locationAt (n).end);
+      return new ]b4_location_type[ (rhs.locationAt (n-1).begin, rhs.locationAt (0).end);
     else
       return new ]b4_location_type[ (rhs.locationAt (0).end);
   }]])[