}
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() {
}
}
+ 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;
new Class[] {
TibDoc.TD.Doc.class,
TibDoc.TD.Header.class,
+ TibDoc.TD.Section.class,
TibDoc.TD.Body.class,
TibDoc.TD.KV.class
});
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