X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=tests%2Fmeta.g;h=cbfee2aaf3a8dacca295899ddcc610e41be7cc98;hp=72e166529f276fe1e55c57130c66f1d135ac0b54;hb=7d1d5b9e2969e687cc07592f5a212681f8d26479;hpb=50fd2646f65c18357e0639ec0737d329f2072388 diff --git a/tests/meta.g b/tests/meta.g index 72e1665..cbfee2a 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,12 +1,11 @@ +Grammar = NonTerminal +/ ws +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 - -s = !ws (grammar::Grammar) !ws -Grammar = NonTerminal +/ ws -NonTerminal = Word ^"=" RHS /ws RHS = (Sequence +/ (!ws "|" !ws)) +/ (!ws ">" !ws) @@ -28,11 +27,10 @@ Range = 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 +46,7 @@ e = (Quoted|Word) ^":" e | "(" Word ^")" /ws > ^"(" RHS ")" /ws | ^"~" e - > "^^":: "^" e + > "^^":: "^" e Word = [a-zA-Z0-9_]++ Quoted = "\"" ((~[\"\\] | escaped)+) "\"" @@ -59,5 +57,5 @@ escaped = "\n":: "\\n" w = " " | "\n" | "\r" ws = "()":: w** - | "()":: w** "//" ~[\n]* "\n" ws + | "()":: w** "//" (~[\n])* "\n" ws wp = w++