X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FSequence.java;h=b33279352a9a6b61c4cfd4bfa3e29629c3670e6f;hp=d25260450ef90d7ae0ad6466d69edc00026ff283;hb=888e9ccbab5f458a727c16da9d9291fd8951d909;hpb=0516ea34996c86664928ef948013b749876b87ec diff --git a/src/edu/berkeley/sbp/Sequence.java b/src/edu/berkeley/sbp/Sequence.java index d252604..b332793 100644 --- a/src/edu/berkeley/sbp/Sequence.java +++ b/src/edu/berkeley/sbp/Sequence.java @@ -35,7 +35,8 @@ public abstract class Sequence extends Element implements Iterable { //////////////////////////////////////////////////////////////////////////////// - public Topology noFollow() { return null; } + public Element noFollow = null; + public final Topology noFollow() { return noFollow==null ? null : noFollow.toAtom(); } Topology toAtom() { if (elements.length!=1) throw new RuntimeException("cannot invoke toAtom() on a Sequence with " + elements.length + " elements: " + this); @@ -61,8 +62,6 @@ public abstract class Sequence extends Element implements Iterable { this.firstp = new Position(0); } - void reachable(HashSet h) { firstp().reachable(h); } - Forest epsilonForm() { return firstp().rewrite(null); } protected abstract Forest postReduce(Token.Location loc, Forest[] args); @@ -73,12 +72,6 @@ public abstract class Sequence extends Element implements Iterable { /** the imaginary position before or after an element of a sequence; corresponds to an "LR item" */ public class Position { - void reachable(HashSet h) { - if (h.contains(this)) return; - h.add(this); - if (element() != null) element().reachable(h); - } - final int pos; private final Position next; final Forest[] holder;