2 // URGENT: why does swapping [a-zA-Z0-9] for alphanum in "item" cause severe breakage?
3 // URGENT: why does enabling "url" cause severe breakage? (probably same cause)
4 // ... something to do with unit productions
8 // output formats: latex, contex, ps, pdf, html, man, txt, rfc
18 // today's date, last edit date
22 // citations/references
26 // FIXME: these have to go at the top so they have their dropAll bit set before PreSequence.build...
31 //////////////////////////////////////////////////////////////////////////////
35 Doc ::= Header Body /ws => doc
36 Header ::= "header" { kv */ ws } /ws => header
37 Body ::= Section*/ws => body
38 Section ::= SectionHeader ({text}*/ws) /ws => section
39 SectionHeader ::= "==" SectionHeaderBody "=="
40 SectionHeaderBody ::= "=" SectionHeaderBody "="
43 kv ::= word "=" text /ws => kv1
46 pre ::= "[verbatim]" { [~]+ } /ws => "verbatim" // FIXME doesn't work
51 > "\"" text "\"" => quoted
55 symbol ::= symbolx & sym++
56 symbolx ::= "--" => emdash
61 styled ::= "**" text "**" => bold
62 | "__" text "__" => ul
63 | "~~" text "~~" => it // hard to type
64 | "((" text "))" => footnote
69 glyph ::= "(r)" | "(c)" | "(tm)" // euro symbol?
72 // URLs //////////////////////////////////////////////////////////////////////////////
74 // interesting opportunity to show off boolean grammars here: define other
75 // subtypes of url (ftp, etc) as conjunctions, but the "master pattern"
76 // only gets parsed once
79 username ::= [a-zA-Z0-9;/?:&=$\-_.+]++
80 password ::= [a-zA-Z0-9;/?:&=$\-_.+]++
81 urlchar ::= [a-zA-Z0-9;/?:&=$\-_.+@]
82 | "%" [0-9] [0-9] => "%"
83 url ::= "mailto" ":" email
84 > method "://" url_login? host (":" port)? ("/" urlpath)? => "url"
85 url_login ::= username (":" password) "@" => "login"
86 method ::= [+\-.a-z0-9]+
89 domain ::= part +/ "."
90 part ::= [a-zA-Z0-9\-]++ // interesting use of boolean grammars
91 // &~ ([\-0-9] [~]* | [~]* [\-0-9])
93 email ::= username "@" host => email
94 host ::= [0-9]+ "." [0-9]+ "." [0-9]+ "." [0-9]+ => "ip"
99 // Tokens ///////////////////////////////////////////////////////////////////
104 quoted ::= "\"" (([~\"\\] | escaped)+) "\""
106 escaped ::= "\\n" => "\n"
111 // Chars ///////////////////////////////////////////////////////////////
115 alphanum ::= [a-zA-Z0-9]
116 sym ::= [~a-zA-Z0-9\ \r\n]