add backslash to braces in metagrammar
authoradam <adam@megacz.com>
Mon, 26 Feb 2007 01:35:57 +0000 (20:35 -0500)
committeradam <adam@megacz.com>
Mon, 26 Feb 2007 01:35:57 +0000 (20:35 -0500)
darcs-hash:20070226013557-5007d-75b76511e6126687b6fffe1e6cc92c0696d6b538.gz

src/edu/berkeley/sbp/meta/MetaGrammarBindings.java
tests/meta.g

index 4ae0393..927cd62 100644 (file)
@@ -321,6 +321,11 @@ public class MetaGrammarBindings extends AnnotationGrammarBindings {
         }
     }
 
         }
     }
 
+    public static @bind.as("\\{") ElementNode   leftBrace() {
+        return new Drop(new CharClass(new Range[] { new Range(CharAtom.left, CharAtom.left) })); }
+    public static @bind.as("\\}") ElementNode   rightBrace() {
+        return new Drop(new CharClass(new Range[] { new Range(CharAtom.right, CharAtom.right) })); }
+
     public static @bind.as("{")           class XTree                 extends ElementNode {
         public @bind.arg Seq body;
         public Element build(Context cx, NonTerminalNode cnt) {
     public static @bind.as("{")           class XTree                 extends ElementNode {
         public @bind.arg Seq body;
         public Element build(Context cx, NonTerminalNode cnt) {
index 61a6437..abe03f3 100644 (file)
@@ -55,8 +55,8 @@ e             =                (Quoted|Word) ^":" e
               |                  ^"^"   Quoted
               >                  ^"(" RHS  ")"           /ws
               |                  ^"~" e
               |                  ^"^"   Quoted
               >                  ^"(" RHS  ")"           /ws
               |                  ^"~" e
-              |                  ^"{"
-              |                  ^"}"
+              |                  ^"\\{"
+              |                  ^"\\}"
 
 NonTerminalReference = Word
 Literal              = Quoted
 
 NonTerminalReference = Word
 Literal              = Quoted