diff options
author | Joel E. Denny <jdenny@clemson.edu> | 2011-03-06 22:48:46 -0500 |
---|---|---|
committer | Joel E. Denny <jdenny@clemson.edu> | 2011-03-06 23:29:03 -0500 |
commit | 1a33f4f60872281c70c2aea3f8529d8660609609 (patch) | |
tree | 0480ab714346aed514f7c12c7fd0a9ee26cf4512 | |
parent | 3f8ffd15eea8c3da460f8d40c80dd02cb1204a5a (diff) | |
download | bison-1a33f4f60872281c70c2aea3f8529d8660609609.tar.gz |
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.
(cherry picked from commit 4c2a6e42ba8b6bc4e04985f5ef3ec8926048d4b1)
Conflicts:
data/lalr1.java
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | NEWS | 7 | ||||
-rw-r--r-- | data/lalr1.java | 4 |
3 files changed, 16 insertions, 3 deletions
@@ -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. @@ -350,7 +350,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): diff --git a/data/lalr1.java b/data/lalr1.java index e1b488c4..79c15f1f 100644 --- a/data/lalr1.java +++ b/data/lalr1.java @@ -297,14 +297,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; } |