X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=tests%2Fmeta.g;h=43f539a77a4f0c4229a75a5cf9b6bdd3cb0ddede;hp=807f15f080c93a0453c3a452db883844f3ec69ae;hb=86e7e1298601b60df964e3c0a71f3fe3cca230b8;hpb=5964a1161340a16d7dea471372737f2474576ceb diff --git a/tests/meta.g b/tests/meta.g index 807f15f..43f539a 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,28 +1,28 @@ -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 -PreSequence ::= Elements => "ps" +PreSequence = Elements => "ps" | PreSequence !wp ^"/" !ws e | PreSequence ^"->" e /ws - | (Quoted|word) ^"::" PreSequence /ws +// | (Quoted|word) ^"::" PreSequence /ws | PreSequence ^"=>" ("[]"|"()"|word|Quoted) /ws -Sequence ::= PreSequence => "psx" +Sequence = PreSequence => "psx" -ec ::= ~[\-\]\\] +ec = ~[\-\]\\] | escaped -Range ::= ec => "range" +Range = ec => "range" | ec ^"-" ec -e ::= +e = (Quoted|word) ^":" e > word => "nonTerminal" | Quoted => "literal" @@ -45,15 +45,15 @@ e ::= > ^"(" 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++