X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=tests%2Fmeta.g;h=dd222e0fb820f433120e48c0be39db3442a44528;hb=db7344562a20ef098b1f5dc66e8325e55711032c;hp=c9f53a2701813254feee1d6ed3b73ec45134aaa8;hpb=0cbfa6761776083d952b492517ce9f5b866864f5;p=sbp.git diff --git a/tests/meta.g b/tests/meta.g index c9f53a2..dd222e0 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,34 +1,34 @@ -s ::= !ws Grammar ws => "gram" -Grammar ::= NonTerminal +/ ws => "grammar" -NonTerminal ::= word ^"::=" RHS /ws +s = !ws Grammar ws => "gram" +Grammar = NonTerminal +/ ws => "grammar" +NonTerminal = word !wp ^"=" !wp RHS + +RHS = (Conjuncts +/ (!ws "|" !ws)) +/ (!ws ">" !ws) -RHS ::= (Conjuncts +/ (!ws "|" !ws)) +/ (!ws ">" !ws) - -Conjuncts ::= Sequence +Conjuncts = Sequence | Sequence ^"&" Elements /ws | Sequence ^"&~" Elements /ws -Elements ::= e*/ws +Elements = e*/ws -psy ::= Elements => "ps" - | psy !wp ^"/" !ws e - | psy ^"->" e /ws -Sequence ::= Quoted => "qprod" - > psy => "psx" - | psy "=>" ^"[]" /ws - | psy ^"=>" ("()"|word|Quoted) /ws +PreSequence = Elements => "ps" + | PreSequence !wp ^"/" !ws e + | PreSequence ^"->" e /ws + | (Quoted|word) ^"::" PreSequence /ws + | PreSequence ^"=>" ("[]"|"()"|word|Quoted) /ws +Sequence = PreSequence => "psx" -ec ::= ~[\-\]\\] +ec = ~[\-\]\\] | escaped -Range ::= ec => "range" +Range = ec => "range" | ec ^"-" ec -e ::= word => "nonTerminal" +e = + (Quoted|word) ^":" e + > word => "nonTerminal" | Quoted => "literal" | ^"()" | ^"{" Sequence "}" /ws | ^"[" Range* "]" - | e ^"++" /ws -> ~[/] | e ^"+" /ws -> ~[+] | e ^"++/" e /ws @@ -45,15 +45,15 @@ e ::= word => "nonTerminal" > ^"(" RHS ")" /ws | ^"~" e -word ::= [a-zA-Z0-9_]++ -Quoted ::= "\"" ((~[\"\\] | escaped)+) "\"" +word = [a-zA-Z0-9_]++ +Quoted = "\"" ((~[\"\\] | escaped)+) "\"" | "\"\"" => "" -escaped ::= "\\n" => "\n" +escaped = "\\n" => "\n" | "\\r" => "\r" | "\\" ~[nr] -w ::= " " | "\n" | "\r" -ws ::= w** => () +w = " " | "\n" | "\r" +ws = w** => () | w** "//" ~[\n]* "\n" ws => () -wp ::= w++ +wp = w++