checkpoint
authoradam <adam@megacz.com>
Sat, 15 Jul 2006 05:44:45 +0000 (01:44 -0400)
committeradam <adam@megacz.com>
Sat, 15 Jul 2006 05:44:45 +0000 (01:44 -0400)
darcs-hash:20060715054445-5007d-ba92f5bae47341767075d6e737a98d476aa7aa3a.gz

src/edu/berkeley/sbp/Forest.java
src/edu/berkeley/sbp/Sequence.java

index baf1265..48f88a2 100644 (file)
@@ -77,11 +77,9 @@ public abstract class Forest<T> /*extends PrintableTree<Forest.MyBody<T>>*/
         public InnerAmbiguous(Forest<?> f) { this.f = f; }
     }
 
-    static        <T> Forest<T> singleton(Input.Region loc, Position p) { return create(loc, null, new Forest[] { }, false, p); }
-    static        <T> Forest<T> singleton(Input.Region loc, Forest<T> body, Position p) { return body; }
     static        <T> Forest<T> leaf(Input.Region loc, T tag, Position p) { return create(loc, tag, null, false, p); }
     public static <T> Forest<T> create(Input.Region loc, T tag, Forest<T>[] tokens, boolean unwrap, Position p) {
-        return new MyBody<T>(loc, tag, tokens, unwrap, p);
+        return new MyBody<T>(loc, tag, tokens, unwrap);
     }
     // Body //////////////////////////////////////////////////////////////////////////////
 
@@ -99,7 +97,7 @@ public abstract class Forest<T> /*extends PrintableTree<Forest.MyBody<T>>*/
             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<T> /*extends PrintableTree<Forest.MyBody<T>>*/
         private final T                 tag;
         private final Forest<T>[]       tokens;
         private final boolean           unwrap;
-        private final Sequence.Position reduction;
 
-        private MyBody(Input.Region loc, T tag, Forest<T>[] tokens, boolean unwrap, Position reduction) {
+        private MyBody(Input.Region loc, T tag, Forest<T>[] 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<tokens.length; i++) if (tokens[i]==null) throw new Error(i+"");
             this.unwrap = unwrap;
-            this.reduction = reduction;
         }
         public void gather(TaskList tl, HashSet<Tree<T>>[] ht, HashSet<Tree<T>> target) {
             gather(tl, ht, target, new Tree[ht.length], 0);
index 1b336ff..a2e6f99 100644 (file)
@@ -202,7 +202,7 @@ public abstract class Sequence extends Element implements Iterable<Element> {
         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 <T> Forest<T> postReduce(Input.Region loc, Forest<T>[] args, Position p) { return (Forest<T>)Forest.singleton(loc, args[idx], p); }
+        public <T> Forest<T> postReduce(Input.Region loc, Forest<T>[] args, Position p) { return args[idx]; }
         Sequence _clone() { return new Singleton(elements,idx); }
     }