-s ::= Doc => top
-
-Doc ::= {Header} Body /ws => doc
-Header ::= "header" { kv */ ws } /ws => header
-Body ::= Section*/ws => body
-Section ::= { SectionHeader Paragraph* /ws => section }
-SectionHeader ::= "==" SectionHeaderBody "=="
-SectionHeaderBody ::= "=" SectionHeaderBody "="
- > ws text ws
-
-sp !::= " "**
-blank ::= sp "\n" sp "\n" ws
-
-kv ::= word "=" text /ws => kv1
-
-num !::= [0-9]++
-Paragraph ::= { "\"\"" ws text } => "blockquote"
- > { "*" " " ws text } => "ul"
- > { "#" " " ws text } => "ol"
- > { num " " ws text } => "ol"
- > { "---" "-"* } => "hr"
- > { text } => "p"
-
-text ::= item
-itemx ::= ws item | ()
-item ::= blockquote
- > pre itemx => []
- > structured itemx => []
- > structuredx itemx => []
- > styled itemx => []
- > qtext itemx => []
- > alphanum++ itemx => []
- > symbol itemx => []
-// > sym++ itemx => []
- > Paragraph itemx => []
-
-symbol ::= sym++
-
-blockquote ::= "\"\"" text "\"\"" => "blockquote"
- | "\"\"" block => "blockquote"
+s = Doc
+
+Doc = head:Header ws! body:Body
+Header = { "\\header" { KeyVal */ ws } /ws }
+Body = { Section } */ws
+Section = SectionHeader ws! Paragraph*
+SectionHeader = "==" SectionHeaderBody "=="
+SectionHeaderBody = "=" SectionHeaderBody "="
+ > ws! text ws!
+
+sp = " "**
+blank = sp! "\n" sp! "\n" ws!
+
+KeyVal = key:bareword "=" val:text /ws
+wp = w++
+num = [0-9]++
+
+Paragraph = { Blockquote:: "\"\" " text }
+ > HR:: { "---" "-"* }
+ > { OL:: (text &~ (text! ws! {oli}+)) ws! {oli}+ }
+ > P:: { text }
+
+onums = nums (". "|") ")!
+any = ~[]*
+
+uli = "* " (ws! text &~ any (oli|uli)!)
+oli = onums! (ws! text &~ any (oli|uli)!)
+
+text = Item
+
+Item*/ws =
+ blockquote
+// > ^"#" ws! { ~[]* }
+ > Verbatim
+ > InlineGrammar
+ > link
+ > structured
+ > styled
+ > (Chars:: alphanum++)
+ > Quotes:: "\"" text "\""
+ > (Symbol:: sym++)
+ > { Block:: text }
+
+word = Chars:: bareword
+
+blockquote = "adsfafewag"
+//blockquote = Blockquote:: "\"\"" (block | text "\"\"")