X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fmeta.g;h=c8230e6f1fe28a5d64d611daa7c04aa268b0cec7;hb=80128a38a1c907f1860a5cb13769d691be059a5f;hp=72e166529f276fe1e55c57130c66f1d135ac0b54;hpb=50fd2646f65c18357e0639ec0737d329f2072388;p=sbp.git diff --git a/tests/meta.g b/tests/meta.g index 72e1665..c8230e6 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,12 +1,13 @@ +s = !ws Grammar !ws + +Grammar = NonTerminal +/ ws + +NonTerminal = Word "=" RHS /ws // 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 ^"=" RHS /ws RHS = (Sequence +/ (!ws "|" !ws)) +/ (!ws ">" !ws) @@ -24,15 +25,14 @@ Sequence = psx:: PreSequence ec = ~[\-\]\\] | escaped -Range = range:: ec - | ec ^"-" ec +Range = ec + | ec ^"-" ec e = (Quoted|Word) ^":" e - > - nonTerminal:: Word + > nonTerminal:: Word | literal:: Quoted | ^"()" - | ^"{" PreSequence "}" /ws + | ^"{" PreSequence "}" /ws | ^"[" Range* "]" | e ^"++" /ws -> ~[/] | e ^"+" /ws -> ~[+] @@ -48,7 +48,7 @@ e = (Quoted|Word) ^":" e | "(" Word ^")" /ws > ^"(" RHS ")" /ws | ^"~" e - > "^^":: "^" e + > "^^":: "^" e Word = [a-zA-Z0-9_]++ Quoted = "\"" ((~[\"\\] | escaped)+) "\"" @@ -59,5 +59,5 @@ escaped = "\n":: "\\n" w = " " | "\n" | "\r" ws = "()":: w** - | "()":: w** "//" ~[\n]* "\n" ws + | "()":: w** "//" (~[\n])* "\n" ws wp = w++