X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=tests%2Fmeta.g;h=845af526ba34d8b783b90952d02cc06927073819;hp=0d2be6f86f6a9a577404da3453f0469c1fd18df2;hb=225993309e6183afa9a88fc13d39df56be54b992;hpb=df32ec862cecf0851a7f7342582b5786d04a4771 diff --git a/tests/meta.g b/tests/meta.g index 0d2be6f..845af52 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,6 +1,13 @@ -s = ws grammar:Grammar ws Grammar = NonTerminal +/ ws -NonTerminal = Word !wp ^"=" !wp RHS +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 + +blah = "Grammar" RHS = (Sequence +/ (!ws "|" !ws)) +/ (!ws ">" !ws) @@ -8,12 +15,12 @@ Elements = e*/ws PreSequence = ps:: Elements | (Quoted|Word) ^"::" PreSequence /ws - > PreSequence !wp ^"/" !ws e - | PreSequence ^"->" e /ws + > PreSequence ^"/" e /ws + | PreSequence ^"->" e /ws Sequence = psx:: PreSequence - | Sequence !ws ^"&" !ws Elements - | Sequence !ws ^"&~" !ws Elements + | Sequence ^"&" Elements /ws + | Sequence ^"&~" Elements /ws ec = ~[\-\]\\] | escaped @@ -25,7 +32,7 @@ e = (Quoted|Word) ^":" e > nonTerminal:: Word | literal:: Quoted | ^"()" - | ^"{" Sequence "}" /ws + | ^"{" PreSequence "}" /ws | ^"[" Range* "]" | e ^"++" /ws -> ~[/] | e ^"+" /ws -> ~[+] @@ -41,7 +48,7 @@ e = (Quoted|Word) ^":" e | "(" Word ^")" /ws > ^"(" RHS ")" /ws | ^"~" e - > "^^":: "^" e + > "^^":: "^" e Word = [a-zA-Z0-9_]++ Quoted = "\"" ((~[\"\\] | escaped)+) "\"" @@ -52,5 +59,5 @@ escaped = "\n":: "\\n" w = " " | "\n" | "\r" ws = "()":: w** - | "()":: w** "//" ~[\n]* "\n" ws + | "()":: w** "//" (~[\n])* "\n" ws wp = w++