checkpoint
authoradam <adam@megacz.com>
Sun, 2 Jul 2006 18:04:51 +0000 (14:04 -0400)
committeradam <adam@megacz.com>
Sun, 2 Jul 2006 18:04:51 +0000 (14:04 -0400)
darcs-hash:20060702180451-5007d-fccdee589fbd97cb09acc0bf19cbce2902218e4e.gz

src/edu/berkeley/sbp/chr/CharRange.java
src/edu/berkeley/sbp/misc/Demo.java
src/edu/berkeley/sbp/misc/MetaGrammar.java
tests/tibdoc.g

index 8952536..6728012 100644 (file)
@@ -19,8 +19,9 @@ public class CharRange extends Atom<Character> {
 
     public static final char left       = (char)9998;
     public static final char right      = (char)9999;
-    public static final Atom leftBrace  = new CharRange(left,left)   { public String toString() { return "{"; } };
-    public static final Atom rightBrace = new CharRange(right,right) { public String toString() { return "}"; } };
+    public static final Atom leftBrace  = new CharRange(left,left)   { public String toString() { return "[{]"; } };
+    public static final Atom rightBrace = new CharRange(right,right) { public String toString() { return "[}]"; } };
+    public static final Atom braces     = new CharRange(left,right)   { public String toString() { return "[{}]"; } };
 
     public static Atom set(Range.Set r) { return new CharRange(new CharTopology(r)); }
 
index b3b9f4c..6b183e9 100644 (file)
@@ -94,7 +94,7 @@ public class Demo {
         }
         public Object repeatTag() {
             return new Reducer() {
-                    public String toString() { return "[**]"; }
+                    public String toString() { return ""; }
                     public Object reduce(Tree t) {
                         Object[] ret = new Object[t.numChildren()];
                         for(int i=0; i<t.numChildren(); i++) {
index e9c4413..1f7718f 100644 (file)
@@ -406,7 +406,9 @@ public class MetaGrammar extends StringWalker {
                 public MetaClause element;
                 public MetaInvert(Tree<String> t, Conjunct c) { this.element = makeMetaClause(t, c); }
                 public String toString() { return "~"+element; }
-                public Element build(BuildContext bc) { return infer((Topology<Character>)Atom.toAtom(element.build(bc)).complement()); }
+                public Element build(BuildContext bc) {
+                    return infer((Topology<Character>)Atom.toAtom(element.build(bc)).complement().minus(CharRange.braces));
+                }
             }
 
     }
index 2afac83..218274b 100644 (file)
@@ -59,7 +59,7 @@ s                   = Doc
 Doc                 = head:{Header} body:Body  /ws
 Header              = "header" attrs:{ KeyVal */ ws }  /ws
 Body                = {Section}*/ws
-Section             = SectionHeader Paragraph* /ws
+Section             = SectionHeader Paragraphs /ws
 SectionHeader       = "==" SectionHeaderBody "=="
 SectionHeaderBody   =  "=" SectionHeaderBody "="
                     >      !ws alphanum++ !ws
@@ -70,9 +70,10 @@ blank    = !sp "\n" !sp "\n" !ws
 KeyVal       = key:word "=" val:text /ws
 wp           = w++
 num          = [0-9]++
-Paragraph    = Blockquote:: { "\"\" "    text }
-             > HR::         { "---" "-"*      }
-             > P::          { text }
+Paragraphs   = "[]":: { Blockquote:: "\"\" "    text } Paragraphs
+             > "[]":: { HR::         "---" "-"*      } Paragraphs
+             > "[]":: { P::          text            } Paragraphs
+             > ()
 
 onums        = nums !(". "|") ")
 any          = ~[]*
@@ -94,7 +95,7 @@ Item         = blockquote
              > "[]":: "\"" text "\""             Itemx
 //           > "[]":: symbol                     Itemx
              > "[]":: (Symbol:: sym++)           Itemx
-             > "[]":: Paragraph                  Itemx
+//             > "[]":: Paragraph                  Itemx
 
 blockquote   = Blockquote:: "\"\"" text "\"\""
              | Blockquote:: "\"\"" block