X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=tests%2Fmeta.g;h=cbfee2aaf3a8dacca295899ddcc610e41be7cc98;hb=b205c5ee125119b0372328b70e8a66164df18fd0;hp=be8e435d9370275e14adcbe89137e28c612141b8;hpb=1a249057cbfd2180910e46672eafee3af46ae470;p=sbp.git diff --git a/tests/meta.g b/tests/meta.g index be8e435..cbfee2a 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,6 +1,11 @@ -s = ws grammar:Grammar ws Grammar = NonTerminal +/ ws +s = !ws (grammar::Grammar) !ws NonTerminal = Word ^"=" RHS /ws + +// use 'a'-'z' or 'a-z' instead of [a-z]? +// EOF token? +// #include (with renaming?) +// ANTLR uses ! and ^ suffixes RHS = (Sequence +/ (!ws "|" !ws)) +/ (!ws ">" !ws) @@ -25,7 +30,7 @@ e = (Quoted|Word) ^":" e > nonTerminal:: Word | literal:: Quoted | ^"()" - | ^"{" Sequence "}" /ws + | ^"{" PreSequence "}" /ws | ^"[" Range* "]" | e ^"++" /ws -> ~[/] | e ^"+" /ws -> ~[+] @@ -41,7 +46,7 @@ e = (Quoted|Word) ^":" e | "(" Word ^")" /ws > ^"(" RHS ")" /ws | ^"~" e - > "^^":: "^" e + > "^^":: "^" e Word = [a-zA-Z0-9_]++ Quoted = "\"" ((~[\"\\] | escaped)+) "\"" @@ -52,5 +57,5 @@ escaped = "\n":: "\\n" w = " " | "\n" | "\r" ws = "()":: w** - | "()":: w** "//" ~[\n]* "\n" ws + | "()":: w** "//" (~[\n])* "\n" ws wp = w++