X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FWalk.java;h=c6bb514e31f4a14bdb072de5e12cf5aa4af83153;hb=d28917b3c84c429e8fd6587717df9e90a894b18f;hp=8c6ecae17d897509e18d764dddb2346275f46135;hpb=5d18f5606c9296e6b0c5749f05fc68f358ace2f6;p=sbp.git diff --git a/src/edu/berkeley/sbp/Walk.java b/src/edu/berkeley/sbp/Walk.java index 8c6ecae..c6bb514 100644 --- a/src/edu/berkeley/sbp/Walk.java +++ b/src/edu/berkeley/sbp/Walk.java @@ -37,7 +37,13 @@ abstract class Walk { else if (e instanceof Sequence) return sequence((Sequence)e); else if (e instanceof Union) { T ret = bottom(e); - for(Sequence s : (Union)e) ret = union((Union)e, ret, walk(s)); + for(Sequence s : (Union)e) { + ret = union((Union)e, ret, walk(s)); + + // FIXME + for(Sequence ss : s.needs()) ret = union((Union)e, ret, walk(ss)); + for(Sequence ss : s.hates()) ret = union((Union)e, ret, walk(ss)); + } return ret; } else { throw new Error("unknown element of class " + e.getClass().getName() + ": " + e); @@ -82,7 +88,7 @@ abstract class Walk { public WalkTokenSet(Topology cs) { this.cs = cs; } public WalkTokenSet(Topology cs, Cache c) { super(c); this.cs = cs; } public Topology bottom(Element e) { return cs; } - public Topology walkAtom(Atom r) { cs = cs.union(r); return cs; } + public Topology walkAtom(Atom r) { cs = cs.union(r.getTokenTopology()); return cs; } } static class First extends WalkTokenSet { @@ -149,7 +155,7 @@ abstract class Walk { if (e instanceof Sequence) { Sequence s = (Sequence)e; - if (s.noFollow() != null) cs = cs.minus(s.noFollow()); + if (s.follow() != null) cs = cs.intersect(s.follow().getTokenTopology()); } if (c != null && e==me) {