- /** an atom which tracks the possible tokenset of some element, provided that element can only match single-token sequences */
- public static class Infer<T extends Input> extends Atom<T> {
- private final Element e;
- public Infer(Element e) { this.e = e; }
- public Topology<T> top() { return (Topology<T>)toAtom(e); }
- 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;
- public Invert(Atom<T> a) { this.a = a; }
- public Topology<T> top() { return a.complement(); }
- public String toString() { return "~"+a; }
- }
-
- public static class Hack<T extends Input> extends Atom<T> {
- private final Atom<T> a;
- static final Topology leftright = CharRange.rightBrace.union(CharRange.leftBrace);
- public Hack(Atom<T> a) { this.a = a; }
- public Topology<T> top() { return a.minus(leftright); }
- public String toString() { return a.toString(); }
- }
-