public String toString() { return e.toString(); }
}
+ public static Atom infer(Element e) { return new CharRange((Topology<Character>)Atom.toAtom(e)); }
+
/** an atom which tracks the inverse of some other atom */
public static class Invert<T extends Input> extends Atom<T> {
private final Atom<T> a;
if (idx != -1) ret = Sequence.singleton(els, idx);
else ret = Sequence.drop(els, false);
}
- if (this.followedBy != null) ret.follow = new Hack(new Infer(this.followedBy.build(bc)));
+ if (this.followedBy != null) ret.follow = new Hack(infer(this.followedBy.build(bc)));
return ret;
}
private MetaConjunct(Tree<String> t) {
return !maximal
? new Repeat(element.build(bc), zero, many, separator==null?null:separator.build(bc), null)
: separator==null
- ? new Repeat.Maximal(element.build(bc), zero, many, null)
- : new Repeat.Maximal(element.build(bc), zero, many, separator.build(bc), null);
+ ? new Repeat.Maximal(infer(element.build(bc)), zero, many, null)
+ : new Repeat.Maximal(element.build(bc), zero, many, infer(separator.build(bc)), null);
}
public MetaRepeat(MetaClause element, boolean maximal, MetaClause separator, boolean zero, boolean many) {
this.separator = separator;
public MetaClause element;
public MetaInvert(Tree<String> t, MetaConjunct c) { this.element = make(t, c); }
public String toString() { return "~"+element; }
- public Element build(BuildContext bc) { return new Hack(new Invert(new Infer(element.build(bc)))); }
+ public Element build(BuildContext bc) { return new Hack(new Invert(infer(element.build(bc)))); }
}
}