X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=tests%2Fmeta.g;h=cbfee2aaf3a8dacca295899ddcc610e41be7cc98;hb=b205c5ee125119b0372328b70e8a66164df18fd0;hp=3ee8fdf2e57c1168af2f8f6d82887cfcac3cf367;hpb=45d799349e635f1a99e3974e4504a43d5a7aaf33;p=sbp.git diff --git a/tests/meta.g b/tests/meta.g index 3ee8fdf..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) @@ -31,7 +30,7 @@ e = (Quoted|Word) ^":" e > nonTerminal:: Word | literal:: Quoted | ^"()" - | ^"{" PreSequence "}" /ws + | ^"{" PreSequence "}" /ws | ^"[" Range* "]" | e ^"++" /ws -> ~[/] | e ^"+" /ws -> ~[+] @@ -47,7 +46,7 @@ e = (Quoted|Word) ^":" e | "(" Word ^")" /ws > ^"(" RHS ")" /ws | ^"~" e - > "^^":: "^" e + > "^^":: "^" e Word = [a-zA-Z0-9_]++ Quoted = "\"" ((~[\"\\] | escaped)+) "\"" @@ -58,5 +57,5 @@ escaped = "\n":: "\\n" w = " " | "\n" | "\r" ws = "()":: w** - | "()":: w** "//" ~[\n]* "\n" ws + | "()":: w** "//" (~[\n])* "\n" ws wp = w++