checkpoint harmony
[sbp.git] / src / edu / berkeley / sbp / Walk.java
index b7f147d..22ef52e 100644 (file)
@@ -1,7 +1,6 @@
 package edu.berkeley.sbp;
-import edu.berkeley.sbp.util.*;
-import edu.berkeley.sbp.*;
 import edu.berkeley.sbp.*;
+import edu.berkeley.sbp.util.*;
 import edu.berkeley.sbp.Sequence.Position;
 import java.io.*;
 import java.util.*;
@@ -121,13 +120,11 @@ abstract class Walk<T> {
 
             Topology<Tok> cso = cs;
             boolean eofo = eof;
-            eof = false;
+            eof = c.eof.get(e) != null && c.eof.get(e).booleanValue();
             cs = cso.empty();
 
-            if (e instanceof Parser.Top) eof = true;
             for(Element x : all) {
                 boolean matched = false;
-                if (x instanceof Parser.Top) walk(x); // because this symbol might not appear in any other Sequence
                 if (!(x instanceof Sequence)) continue;
                 Sequence a = (Sequence)x;
                 Position mp = null;
@@ -140,7 +137,7 @@ abstract class Walk<T> {
                         if (top==null) continue;
                         if (!(top.containsAll(((Atom)e)))) continue;
                     } else {
-                        if (c.ys.get(pos.element()).contains(e)) good = true;
+                        if (c.ys.contains(pos.element(),e)) good = true;
                     }
                     if (good) {
                         mp = pos;
@@ -173,7 +170,7 @@ abstract class Walk<T> {
         public final HashMap<Element,Boolean> possiblyEpsilon = new HashMap<Element,Boolean>();
         public HashMap<Element,Boolean> eof = new HashMap<Element,Boolean>();
         public HashMap<Element,Topology> follow = new HashMap<Element,Topology>();
-        public HashMap<Element,HashSet<Element>>  ys            = new HashMap<Element,HashSet<Element>>();
+        public HashMapBag<Element,Element>  ys = new HashMapBag<Element,Element>();
         public HashMap<Element,Topology> atoms = new HashMap<Element,Topology>();
     }
 }