Atom ret = null;
for(Seq[] ss : sequences)
for(Seq s : ss)
- ret = ret==null ? s.toAtom(cx) : infer(ret.union(s.toAtom(cx)));
+ ret = ret==null ? s.toAtom(cx) : (Atom)ret.union(s.toAtom(cx));
return ret;
}
public void build(Context cx, Union u, NonTerminalNode cnt) {
HashSet<Sequence> bad2 = new HashSet<Sequence>();
Union urep = new Union(null, false);
- urep.add(Sequence.empty);
+ urep.add(Sequence.empty());
if (sep != null)
urep.add(Sequence.singleton(new Element[] { cx.get(sep), u }, 1));
else
}
}
if (this.follow != null)
- ret.follow = this.follow.toAtom(cx);
+ ret = ret.followedBy(this.follow.toAtom(cx));
return ret;
}
}
public static @bind.as("()") ElementNode epsilon() { return new Constant(epsilon); }
private static Union epsilon = new Union("()");
- static { epsilon.add(Sequence.empty); }
+ static { epsilon.add(Sequence.empty()); }
public static class NonTerminalReferenceNode extends ElementNode {
public String nonTerminal;
}
public Element build(Context cx, NonTerminalNode cnt) {
return (!max)
- ? Sequence.repeat(e.build(cx, null), zero, many, sep==null ? null : sep.build(cx, null), cx.rm.repeatTag())
+ ? Repeat.repeat(e.build(cx, null), zero, many, sep==null ? null : sep.build(cx, null), cx.rm.repeatTag())
: sep==null
- ? Sequence.repeatMaximal(e.toAtom(cx), zero, many, cx.rm.repeatTag())
- : Sequence.repeatMaximal(e.build(cx, null), zero, many, sep.toAtom(cx), cx.rm.repeatTag());
+ ? Repeat.repeatMaximal(e.toAtom(cx), zero, many, cx.rm.repeatTag())
+ : Repeat.repeatMaximal(e.build(cx, null), zero, many, sep.toAtom(cx), cx.rm.repeatTag());
}
}
public static @bind.as("\r") String lf() { return "\r"; }
//static Atom infer(Element e) { return infer((Topology<Character>)Atom.toAtom(e)); }
- static Atom infer(Topology<Character> t) { return new CharAtom(new CharTopology(t)); }
+ static Atom infer(Object t) { return (Atom)t; }
public static class Context {
public HashMap<String,Union> map = new HashMap<String,Union>();
public String getLabel() { return label; }
}
+ /*
static class Invert extends Atom {
private final Atom a;
public Invert(Atom a) { this.a = a; }
public Topology top() { return a.complement(); }
public String toString() { return "~"+a; }
}
+ */
}