X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fmeta.g;h=60e3d800d3e1c5893916a17f0091ea1993c4a53f;hb=f56263f0f1cf0c01dfbd8ea7bd1ba8a9c6bd8042;hp=a51109f67f6ecbf9edecf71ee8d9b8af2fb188d0;hpb=7e24ec8964abf26cb768820f42572e0982c5ddf0;p=sbp.git diff --git a/tests/meta.g b/tests/meta.g index a51109f..60e3d80 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,4 +1,4 @@ -s = !ws Grammar !ws +s = ws! Grammar ws! Grammar = NonTerminal +/ ws @@ -7,16 +7,15 @@ 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) +RHS = (Sequence +/ (ws! "|" ws!)) +/ (ws! ">" ws!) Elements = e*/ws -PreSequence = ps:: Elements - | (Quoted|Word) ^"::" PreSequence /ws - > PreSequence ^"/" e /ws - | PreSequence ^"->" e /ws +PreSequence = Elements + | (Quoted|Word) ^"::" PreSequence /ws + > PreSequence ^"/" e /ws + | PreSequence ^"->" e /ws Sequence = psx:: PreSequence | Sequence ^"&" Elements /ws @@ -42,19 +41,19 @@ e = (Quoted|Word) ^":" e | e ^"*" /ws -> ~[*] | e ^"**/" e /ws | e ^"*/" e /ws - | ^"!" e /ws + | e ^"!" | e ^"?" /ws | ^"^" Quoted - | "(" Word ^")" /ws > ^"(" RHS ")" /ws | ^"~" e - > "^^":: "^" e NonTerminalReference = Word -Literal = Quoted -Word = [a-zA-Z0-9_]++ -Quoted = "\"" ((~[\"\\] | escaped)+) "\"" - | "":: "\"\"" +Literal = Quoted +Word = [a-zA-Z0-9_]++ +Quoted = "\"" ((~[\"\\] | escaped)+) "\"" + | EmptyString +EmptyString = "\"\"" + escaped = "\n":: "\\n" | "\r":: "\\r" | "\\" ~[nr]