////////////////////////////////////////////////////////////////////////////////
- public Element follow = null;
- public final Topology follow() { return follow==null ? null : Atom.toAtom(follow); }
-
- Topology toAtom() {
- if (elements.length!=1)
- throw new RuntimeException("cannot invoke toAtom() on a Sequence with " + elements.length + " elements: " + this);
- return Atom.toAtom(elements[0]);
- }
+ public Atom follow = null;
+ public final Topology follow() { return follow; }
public Sequence and(Sequence s) { Sequence ret = dup(); ret.needs.add(s); s.needed.add(ret); return ret; }
public Sequence not(Sequence s) { Sequence ret = dup(); ret.hates.add(s); s.hated.add(ret); return ret; }
}
// DO NOT MESS WITH THE FOLLOWING LINE!!!
- private Forest.Ref epsilonForm = null;
+ private Forest.Many epsilonForm = null;
Forest epsilonForm() {
if (epsilonForm!=null) return epsilonForm;
- epsilonForm = new Forest.Ref();
+ epsilonForm = new Forest.Many();
epsilonForm.merge(firstp().rewrite(null, false));
return epsilonForm;
}
public Constant(Element[] e, Object result) { super(e); this.result = result; }
Sequence _clone() { return new Constant(elements, result); }
public <T> Forest<T> postReduce(Input.Region loc, Forest<T>[] args, Position p) {
- return (Forest<T>)Forest.leaf(loc, result);
+ return (Forest<T>)Forest.create(loc, result, null, false);
}
static class Drop extends Constant {
Sequence _clone() { return new Drop(elements, lame); }