From: adam Date: Wed, 4 Jan 2006 10:47:24 +0000 (-0500) Subject: checkpoint X-Git-Tag: tag_for_25-Mar~444 X-Git-Url: http://git.megacz.com/?p=sbp.git;a=commitdiff_plain;h=e4f373b56b1cdc2c086c0b86e5ec45bad784df0e;ds=sidebyside checkpoint darcs-hash:20060104104724-5007d-c98ffc2ae2c190a82c47d6e03295e7fb1dff0dd8.gz --- 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;