checkpoint
authoradam <adam@megacz.com>
Sun, 2 Jul 2006 08:30:07 +0000 (04:30 -0400)
committeradam <adam@megacz.com>
Sun, 2 Jul 2006 08:30:07 +0000 (04:30 -0400)
darcs-hash:20060702083007-5007d-c29427d0572127d391ed40ef39d0279358429437.gz

src/edu/berkeley/sbp/tib/TibDoc.java
tests/tibdoc.g

index fbe833e..a86fb2b 100644 (file)
@@ -346,7 +346,7 @@ toContex ll = prefix ++ (concatMap tl ll) ++ suffix
         }
         
         public @nonterminal("Body") static class Body {
         }
         
         public @nonterminal("Body") static class Body {
-            public Object[] sections;
+            public Section[] sections;
             // FIXME: it would be nice to be able to
             // void kv(String, String) { ... } imperatively
             public String toString() {
             // FIXME: it would be nice to be able to
             // void kv(String, String) { ... } imperatively
             public String toString() {
@@ -358,6 +358,11 @@ toContex ll = prefix ++ (concatMap tl ll) ++ suffix
             }
         }
         
             }
         }
         
+        public @nonterminal("Section") static class Section {
+            public Object   @arg header;
+            public Object[] @arg paragraphs;
+        }
+        
         public @nonterminal("kv") static class KV {
             public @arg("key") String key;
             public @arg("val") Object val;
         public @nonterminal("kv") static class KV {
             public @arg("key") String key;
             public @arg("val") Object val;
@@ -373,6 +378,7 @@ toContex ll = prefix ++ (concatMap tl ll) ++ suffix
                                         new Class[] {
                                             TibDoc.TD.Doc.class,
                                             TibDoc.TD.Header.class,
                                         new Class[] {
                                             TibDoc.TD.Doc.class,
                                             TibDoc.TD.Header.class,
+                                            TibDoc.TD.Section.class,
                                             TibDoc.TD.Body.class,
                                             TibDoc.TD.KV.class
                                         });
                                             TibDoc.TD.Body.class,
                                             TibDoc.TD.KV.class
                                         });
index 56a84c6..ce60b70 100644 (file)
@@ -58,8 +58,8 @@ s                   = Doc
 
 Doc                 = head:{Header} body:Body  /ws
 Header              = "header" attrs:{ kv */ ws }  /ws
 
 Doc                 = head:{Header} body:Body  /ws
 Header              = "header" attrs:{ kv */ ws }  /ws
-Body                = Section*/ws
-Section             = { Section:: header:SectionHeader paragraphs:Paragraph* /ws }
+Body                = {Section}*/ws
+Section             = SectionHeader Paragraph* /ws
 SectionHeader       = "==" SectionHeaderBody "=="
 SectionHeaderBody   =  "=" SectionHeaderBody "="
                     >      !ws (Chars:: text:alphanum++) !ws
 SectionHeader       = "==" SectionHeaderBody "=="
 SectionHeaderBody   =  "=" SectionHeaderBody "="
                     >      !ws (Chars:: text:alphanum++) !ws