X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=tests%2Fmeta.g;h=062bf2544ea0b95c19b80471bef335b2b487b6c6;hp=0d2be6f86f6a9a577404da3453f0469c1fd18df2;hb=0ab024f487647f99eb000345c29c2f8e9b52a200;hpb=df32ec862cecf0851a7f7342582b5786d04a4771 diff --git a/tests/meta.g b/tests/meta.g index 0d2be6f..062bf25 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,6 +1,12 @@ + +// 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 !wp ^"=" !wp RHS +NonTerminal = Word ^"=" RHS /ws RHS = (Sequence +/ (!ws "|" !ws)) +/ (!ws ">" !ws) @@ -8,12 +14,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 +31,7 @@ e = (Quoted|Word) ^":" e > nonTerminal:: Word | literal:: Quoted | ^"()" - | ^"{" Sequence "}" /ws + | ^"{" PreSequence "}" /ws | ^"[" Range* "]" | e ^"++" /ws -> ~[/] | e ^"+" /ws -> ~[+]