dropped Atom.top()
[sbp.git] / src / edu / berkeley / sbp / Walk.java
index 5754726..abbffd7 100644 (file)
@@ -52,7 +52,7 @@ abstract class Walk<T> {
         public HashSet<Element> bottom(Element e)     { return acc; }
         public HashSet<Element> sequence(Sequence seq) { return bottom(seq); }
         public HashSet<Element> walkAtom(Atom r) {
         public HashSet<Element> bottom(Element e)     { return acc; }
         public HashSet<Element> sequence(Sequence seq) { return bottom(seq); }
         public HashSet<Element> walkAtom(Atom r) {
-            c.atoms.put(e, c.atoms.get(e)==null ? r.top() : c.atoms.get(e).union(r.top()));
+            c.atoms.put(e, c.atoms.get(e)==null ? r.dup() : c.atoms.get(e).union(r.dup()));
             return super.walkAtom(r);
         }
     }
             return super.walkAtom(r);
         }
     }
@@ -83,7 +83,7 @@ abstract class Walk<T> {
         public WalkTokenSet(Topology<Tok> cs)          { this.cs = cs; }
         public WalkTokenSet(Topology<Tok> cs, Cache c) { super(c); this.cs = cs; }
         public Topology<Tok> bottom(Element e)         { return cs; }
         public WalkTokenSet(Topology<Tok> cs)          { this.cs = cs; }
         public WalkTokenSet(Topology<Tok> cs, Cache c) { super(c); this.cs = cs; }
         public Topology<Tok> bottom(Element e)         { return cs; }
-        public Topology<Tok> walkAtom(Atom r)          { cs.add(r.top()); return cs; }
+        public Topology<Tok> walkAtom(Atom r)          { cs.add(r.dup()); return cs; }
     }
 
     class First<Tok extends Token> extends WalkTokenSet<Tok> {
     }
 
     class First<Tok extends Token> extends WalkTokenSet<Tok> {
@@ -152,7 +152,7 @@ abstract class Walk<T> {
                     if (e instanceof Atom) {
                         Topology top = c.atoms.get(pos.element());
                         if (top==null) continue;
                     if (e instanceof Atom) {
                         Topology top = c.atoms.get(pos.element());
                         if (top==null) continue;
-                        if (!(top.containsAll(((Atom)e).top()))) continue;
+                        if (!(top.containsAll(((Atom)e).dup()))) continue;
                     } else {
                         if (c.ys.get(pos.element()).contains(e)) good = true;
                     }
                     } else {
                         if (c.ys.get(pos.element()).contains(e)) good = true;
                     }