From: adam Date: Sat, 15 Jul 2006 05:44:45 +0000 (-0400) Subject: checkpoint X-Git-Tag: tag_for_25-Mar~139 X-Git-Url: http://git.megacz.com/?p=sbp.git;a=commitdiff_plain;h=72a63d7e3092aba0510df50ae8d03b74bb8d556d checkpoint darcs-hash:20060715054445-5007d-ba92f5bae47341767075d6e737a98d476aa7aa3a.gz --- diff --git a/src/edu/berkeley/sbp/Forest.java b/src/edu/berkeley/sbp/Forest.java index baf1265..48f88a2 100644 --- a/src/edu/berkeley/sbp/Forest.java +++ b/src/edu/berkeley/sbp/Forest.java @@ -77,11 +77,9 @@ public abstract class Forest /*extends PrintableTree>*/ public InnerAmbiguous(Forest f) { this.f = f; } } - static Forest singleton(Input.Region loc, Position p) { return create(loc, null, new Forest[] { }, false, p); } - static Forest singleton(Input.Region loc, Forest body, Position p) { return body; } static Forest leaf(Input.Region loc, T tag, Position p) { return create(loc, tag, null, false, p); } public static Forest create(Input.Region loc, T tag, Forest[] tokens, boolean unwrap, Position p) { - return new MyBody(loc, tag, tokens, unwrap, p); + return new MyBody(loc, tag, tokens, unwrap); } // Body ////////////////////////////////////////////////////////////////////////////// @@ -99,7 +97,7 @@ public abstract class Forest /*extends PrintableTree>*/ GraphViz.Node n = gv.createNode(this); n.label = headToString()==null?"":headToString(); n.directed = true; - n.comment = reduction==null?null:reduction+""; + //n.comment = reduction==null?null:reduction+""; edges(n); return n; } @@ -124,16 +122,14 @@ public abstract class Forest /*extends PrintableTree>*/ private final T tag; private final Forest[] tokens; private final boolean unwrap; - private final Sequence.Position reduction; - private MyBody(Input.Region loc, T tag, Forest[] tokens, boolean unwrap, Position reduction) { + private MyBody(Input.Region loc, T tag, Forest[] tokens, boolean unwrap) { this.location = loc; this.tag = tag; this.tokens = tokens==null ? emptyForestArray : new Forest[tokens.length]; if (tokens != null) System.arraycopy(tokens, 0, this.tokens, 0, tokens.length); if (tokens != null) for(int i=0; i>[] ht, HashSet> target) { gather(tl, ht, target, new Tree[ht.length], 0); diff --git a/src/edu/berkeley/sbp/Sequence.java b/src/edu/berkeley/sbp/Sequence.java index 1b336ff..a2e6f99 100644 --- a/src/edu/berkeley/sbp/Sequence.java +++ b/src/edu/berkeley/sbp/Sequence.java @@ -202,7 +202,7 @@ public abstract class Sequence extends Element implements Iterable { private final int idx; public Singleton(Element e) { this(new Element[] { e }, 0); } public Singleton(Element[] e, int idx) { super(e); this.idx = idx; } - public Forest postReduce(Input.Region loc, Forest[] args, Position p) { return (Forest)Forest.singleton(loc, args[idx], p); } + public Forest postReduce(Input.Region loc, Forest[] args, Position p) { return args[idx]; } Sequence _clone() { return new Singleton(elements,idx); } }