]> git.saurik.com Git - bison.git/commitdiff
java: finish fixing parser stack popping bug.
authorJoel E. Denny <jdenny@clemson.edu>
Mon, 7 Mar 2011 03:48:46 +0000 (22:48 -0500)
committerJoel E. Denny <jdenny@clemson.edu>
Mon, 7 Mar 2011 04:07:59 +0000 (23:07 -0500)
* NEWS (2.5): Document.
* data/lalr1.java (YYParser::YYStack::pop): Fix off-by-one error
in clearing the location stack.  Also fix pop function that
accepts no arguments.

ChangeLog
NEWS
data/lalr1.java

index 6331311a80983219e862517d0d02e82a9a80442b..8444a58ba927c44745e79f3355a369fd45e2393c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-03-06  Joel E. Denny  <joeldenny@joeldenny.org>
+
+       java: finish fixing parser stack popping bug.
+       * NEWS (2.5): Document.
+       * data/lalr1.java (YYParser::YYStack::pop): Fix off-by-one error
+       in clearing the location stack.  Also fix pop function that
+       accepts no arguments.
+
 2011-03-06  Angelo Borsotti  <angelo.borsotti@gmail.com>  (tiny change)
 
        java: fix parser stack popping bug.
diff --git a/NEWS b/NEWS
index a657bcc85ed50955a8d44ae53341692e3c53b43d..3f1025771e05c4c151a8270a9a4cd5869c0e1524 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -291,7 +291,12 @@ Bison News
     canonical LR.  However, LAC is still experimental and is disabled
     by default.
 
-** A location handling bug in the Java skeleton has been fixed.
+** Java skeleton fixes:
+
+*** A location handling bug has been fixed.
+
+*** The top element of each of the value stack and location stack is now
+    cleared when popped so that it can be garbage collected.
 
 * Changes in version 2.4.3 (2010-08-05):
 
index 29005c28a8a7761b1e85bbc3ea637d59a5e853c9..2e6cc8a997e229cc03c0ecef240c638daa6737d8 100644 (file)
@@ -255,14 +255,14 @@ b4_lexer_if([[
     }
 
     public final void pop () {
-      height--;
+      pop (1);
     }
 
     public final void pop (int num) {
       // Avoid memory leaks... garbage collection is a white lie!
       if (num > 0) {
        java.util.Arrays.fill (valueStack, height - num + 1, height + 1, null);
-        ]b4_locations_if([[java.util.Arrays.fill (locStack, height - num + 1, height, null);]])[
+        ]b4_locations_if([[java.util.Arrays.fill (locStack, height - num + 1, height + 1, null);]])[
       }
       height -= num;
     }