-s = !ws Grammar !ws
+s = ws! Grammar ws!
Grammar = NonTerminal +/ ws
// #include (with renaming?)
// ANTLR uses ! and ^ suffixes
-RHS = (Sequence +/ (!ws "|" !ws)) +/ (!ws ">" !ws)
+RHS = (Sequence +/ (ws! "|" ws!)) +/ (ws! ">" ws!)
Elements = e*/ws
| e ^"*" /ws -> ~[*]
| e ^"**/" e /ws
| e ^"*/" e /ws
- | ^"!" e /ws
+ | e ^"!"
| e ^"?" /ws
| ^"^" Quoted
- | "(" Word ^")" /ws
+ | Quoted ^"^"
> ^"(" RHS ")" /ws
| ^"~" e
- > "^^":: "^" e
NonTerminalReference = Word
-Literal = Quoted
-Word = [a-zA-Z0-9_]++
-Quoted = "\"" ((~[\"\\] | escaped)+) "\""
- | "":: "\"\""
+Literal = Quoted
+Word = [a-zA-Z0-9_]++
+Quoted = "\"" ((~[\"\\] | escaped)+) "\""
+ | "":: "\"\""
+
escaped = "\n":: "\\n"
| "\r":: "\\r"
| "\\" ~[nr]