X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=tests%2Fmeta.g;h=eb793c5fe91d9ac0b42fd7d66dcb26b9b438f16f;hb=d643fa7e95ca16571a8621ded500abf0215fd5ae;hp=a51109f67f6ecbf9edecf71ee8d9b8af2fb188d0;hpb=7e24ec8964abf26cb768820f42572e0982c5ddf0;p=sbp.git diff --git a/tests/meta.g b/tests/meta.g index a51109f..eb793c5 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,4 +1,4 @@ -s = !ws Grammar !ws +s = ws! Grammar ws! Grammar = NonTerminal +/ ws @@ -9,7 +9,7 @@ NonTerminal = Word "=" RHS /ws // #include (with renaming?) // ANTLR uses ! and ^ suffixes -RHS = (Sequence +/ (!ws "|" !ws)) +/ (!ws ">" !ws) +RHS = (Sequence +/ (ws! "|" ws!)) +/ (ws! ">" ws!) Elements = e*/ws @@ -42,19 +42,19 @@ e = (Quoted|Word) ^":" e | e ^"*" /ws -> ~[*] | e ^"**/" e /ws | e ^"*/" e /ws - | ^"!" e /ws + | e ^"!" | e ^"?" /ws | ^"^" Quoted - | "(" Word ^")" /ws + | Quoted ^"^" > ^"(" RHS ")" /ws | ^"~" e - > "^^":: "^" e NonTerminalReference = Word -Literal = Quoted -Word = [a-zA-Z0-9_]++ -Quoted = "\"" ((~[\"\\] | escaped)+) "\"" - | "":: "\"\"" +Literal = Quoted +Word = [a-zA-Z0-9_]++ +Quoted = "\"" ((~[\"\\] | escaped)+) "\"" + | "":: "\"\"" + escaped = "\n":: "\\n" | "\r":: "\\r" | "\\" ~[nr]