checkpoint
[sbp.git] / src / edu / berkeley / sbp / Forest.java
index df7a3ea..933515b 100644 (file)
@@ -14,7 +14,11 @@ public abstract class Forest<T> /*extends PrintableTree<Forest.Body<T>>*/ implem
         public ArrayList<Tree<T>> toks = new ArrayList<Tree<T>>();
         public void invoke(Forest.Body<T> bod, Boolean toss, Integer i) {
             if (i==null) {
-                addAll(bod.expand(toss, 0, new TreeMaker<T>()));
+                ArrayList<Tree<T>> toks = this.toks;
+                this.toks = new ArrayList<Tree<T>>();
+                //addAll(bod.expand(toss, 0, new TreeMaker<T>()));
+                bod.expand(toss, 0, this);
+                this.toks = toks;
             } else {
                 bod.expand(toss, i, this);
             }
@@ -54,7 +58,6 @@ public abstract class Forest<T> /*extends PrintableTree<Forest.Body<T>>*/ implem
         public <B,C> void invoke(Invokable<Forest.Body<T>,B,C> ivbc, B b, C c) {
             ivbc.invoke(this, b, c);
         }
-        public Iterator<Body<T>> iterator() { return new SingletonIterator<Body<T>>(this); }
 
         private final Input.Location    location;
         private final T                 tag;