X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fedu%2Fberkeley%2Fsbp%2Fmeta%2FMetaGrammarBindings.java;h=c51f71f137c316f11dfa53fa3c5001757839df74;hb=972303162555284f8066047d3caead8df139afd4;hp=3c0575158586ab26060732ca533755240e1e56a4;hpb=e6be1f03f79b16cd410991d7e64cfa7beab6de59;p=sbp.git diff --git a/src/edu/berkeley/sbp/meta/MetaGrammarBindings.java b/src/edu/berkeley/sbp/meta/MetaGrammarBindings.java index 3c05751..c51f71f 100644 --- a/src/edu/berkeley/sbp/meta/MetaGrammarBindings.java +++ b/src/edu/berkeley/sbp/meta/MetaGrammarBindings.java @@ -1,3 +1,5 @@ +// Copyright 2006 all rights reserved; see LICENSE file for BSD-style license + package edu.berkeley.sbp.meta; import edu.berkeley.sbp.util.*; import edu.berkeley.sbp.*; @@ -77,14 +79,13 @@ public class MetaGrammarBindings extends AnnotationGrammarBindings { Seq[] group = sequences[i]; Union u2 = new Union(null, false); if (sequences.length==1) u2 = u; - for(int j=0; j bad2 = new HashSet(); Union urep = new Union(null, false); - urep.add(Sequence.empty()); + 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)e.toAtom(cx).complement().minus(CharAtom.braces)); + return infer((Topology)e.toAtom(cx).complement()/*.minus(CharAtom.braces)*/); } public Element build(Context cx, NonTerminalNode cnt) { - return infer((Topology)e.toAtom(cx).complement().minus(CharAtom.braces)); + return infer((Topology)e.toAtom(cx).complement()/*.minus(CharAtom.braces)*/); } }; } public static @bind.as("Word") String word(String s) { return s; } public static @bind.as("Quoted") String quoted(String s) { return s; } - public static @bind.as("escaped") String c(char c) { return c+""; } + public static @bind.as("escaped") String c(char c) { + if (c=='{') return CharAtom.left+""; + if (c=='}') return CharAtom.right+""; + return c+""; + } public static @bind.as("EmptyString") String emptystring() { return ""; } public static @bind.as("\n") String retur() { return "\n"; } public static @bind.as("\r") String lf() { return "\r"; }