+s = !ws (grammar::Grammar) !ws
+
+Grammar = NonTerminal +/ ws
+
+NonTerminal = Word ^"=" RHS /ws
// use 'a'-'z' or 'a-z' instead of [a-z]?
// EOF token?
// #include (with renaming?)
// ANTLR uses ! and ^ suffixes
-
-s = !ws (grammar::Grammar) !ws
-Grammar = NonTerminal +/ ws
-NonTerminal = Word ^"=" RHS /ws
RHS = (Sequence +/ (!ws "|" !ws)) +/ (!ws ">" !ws)
Range = range:: ec
| ec ^"-" ec
-e =// (Quoted|Word) ^":" e
-// >
- nonTerminal:: Word
+e = (Quoted|Word) ^":" e
+ > nonTerminal:: Word
| literal:: Quoted
| ^"()"
- | ^"{" PreSequence "}" /ws
+ | ^"{" PreSequence "}" /ws
| ^"[" Range* "]"
| e ^"++" /ws -> ~[/]
| e ^"+" /ws -> ~[+]
| "(" Word ^")" /ws
> ^"(" RHS ")" /ws
| ^"~" e
- > "^^":: "^" e
+ > "^^":: "^" e
Word = [a-zA-Z0-9_]++
Quoted = "\"" ((~[\"\\] | escaped)+) "\""
w = " " | "\n" | "\r"
ws = "()":: w**
- | "()":: w** "//" ~[\n]* "\n" ws
+ | "()":: w** "//" (~[\n])* "\n" ws
wp = w++