From e4f373b56b1cdc2c086c0b86e5ec45bad784df0e Mon Sep 17 00:00:00 2001 From: adam Date: Wed, 4 Jan 2006 05:47:24 -0500 Subject: [PATCH] checkpoint darcs-hash:20060104104724-5007d-c98ffc2ae2c190a82c47d6e03295e7fb1dff0dd8.gz --- src/edu/berkeley/sbp/GSS.java | 5 +---- src/edu/berkeley/sbp/Parser.java | 13 +++++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/edu/berkeley/sbp/GSS.java b/src/edu/berkeley/sbp/GSS.java index 5847d6b..a4f3d6a 100644 --- a/src/edu/berkeley/sbp/GSS.java +++ b/src/edu/berkeley/sbp/GSS.java @@ -186,9 +186,6 @@ class GSS { private Forest.Ref holder = null; private boolean allqueued = false; - /** the set of nodes to which there is an edge starting at this node */ - //public final FastSet parents = new FastSet(); /* ALLOC */ - /** what state this node is in */ public final Parser.Table.State state; @@ -212,7 +209,7 @@ class GSS { if (!allqueued) { queueReductions(); return; } for(Parser.Table.Reduction r : state.getReductions(token)) if (r.numPop > 0) - r.reduce(this, n2, null); + r.reduce(this, n2); } diff --git a/src/edu/berkeley/sbp/Parser.java b/src/edu/berkeley/sbp/Parser.java index 90f86f2..f087a05 100644 --- a/src/edu/berkeley/sbp/Parser.java +++ b/src/edu/berkeley/sbp/Parser.java @@ -316,6 +316,19 @@ public abstract class Parser { return ret; } + public Forest reduce(GSS.Phase.Node parent, GSS.Phase.Node onlychild) { + int pos = numPop-1; + if (pos>=0) holder[pos] = parent.pending(); + Forest rex = null; + if (pos==0) { + if (rex==null) { + System.arraycopy(holder, 0, position.holder, 0, holder.length); + rex = position.rewrite(parent.phase().getLocation()); + } + } + return reduce(onlychild, pos-1, rex, null, parent.phase()); + } + private Forest zero = null; public Forest zero() { if (zero != null) return zero; -- 1.7.10.4