X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fedu%2Fberkeley%2Fsbp%2Fmeta%2FMetaGrammarBindings.java;h=7a18babdbc63d30e02b4c3fa3076398b1e1c698a;hb=9b031db4cefc550c82a8bb6da3b061d3790c2cdc;hp=835d79e4bc45461984e2d023258338aeb5e4f9a9;hpb=23091054a6842031d168c2628216c2310149cc5d;p=sbp.git diff --git a/src/edu/berkeley/sbp/meta/MetaGrammarBindings.java b/src/edu/berkeley/sbp/meta/MetaGrammarBindings.java index 835d79e..7a18bab 100644 --- a/src/edu/berkeley/sbp/meta/MetaGrammarBindings.java +++ b/src/edu/berkeley/sbp/meta/MetaGrammarBindings.java @@ -68,26 +68,23 @@ public class MetaGrammarBindings extends AnnotationGrammarBindings { 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 bad2 = new HashSet(); for(int i=0; i bad2 = new HashSet(); - Union urep = new Union(); - urep.add(Sequence.empty); + Union urep = new Union(null, false); + urep.add(Sequence.create()); if (sep != null) - urep.add(Sequence.singleton(new Element[] { cx.get(sep), u }, 1)); + urep.add(Sequence.create(new Element[] { cx.get(sep), u }, 1)); else - urep.add(Sequence.singleton(new Element[] { u }, 0)); + urep.add(Sequence.create(new Element[] { u }, 0)); for(int i=0; i)Atom.toAtom(e)); } - static Atom infer(Topology t) { return new CharAtom(new CharTopology(t)); } + static Atom infer(Object t) { return (Atom)t; } public static class Context { public HashMap map = new HashMap(); @@ -506,10 +493,12 @@ public class MetaGrammarBindings extends AnnotationGrammarBindings { 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; } } + */ }