////////////////////////////////////////////////////////////////////////////////
+ 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);
+ return elements[0].toAtom();
+ }
+
protected final Element[] elements;
final HashSet<Sequence> needs;
this.firstp = new Position(0);
}
- void reachable(HashSet<Position> h) { firstp().reachable(h); }
-
Forest epsilonForm() { return firstp().rewrite(null); }
protected abstract <T> Forest<T> postReduce(Token.Location loc, Forest<T>[] args);
/** the imaginary position before or after an element of a sequence; corresponds to an "LR item" */
public class Position {
- void reachable(HashSet<Position> 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;