X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=tests%2Fmeta.g;h=7dff3eb8801cc44f963383d2d3a7199d085f1ce2;hb=028c0419378758379cef3b058f5b0cb9ff9639fc;hp=13a2c4be53426c9c2e8b9d8faf79e8f3d40c1022;hpb=6f3403873375ea351d7d85b5991c133582a29559;p=sbp.git diff --git a/tests/meta.g b/tests/meta.g index 13a2c4b..7dff3eb 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,29 +1,28 @@ -s ::= Grammar ws => "gram" -ws !::= w** | w** "//" (~[\n]*) "\n" ws -wp !::= w++ -Grammar ::= r +/ ws => "grammar" +s ::= Grammar ws => "gram" +Grammar ::= NonTerminal +/ ws => "grammar" +NonTerminal ::= word ^"::=" RHS /ws -r ::= word ^"::=" alternatives /ws - | word ^"!::=" alternatives /ws +w ::= " " | "\n" | "\r" +ws ::= w** => () + | w** "//" (~[\n]*) "\n" ws => () +wp ::= w++ -alternatives ::= (Conjuncts +/ (ws "|" ws)) +/ (ws ">" ws) +RHS ::= (Conjuncts +/ (!ws "|" !ws)) +/ (!ws ">" !ws) -Conjuncts ::= Sequence - | Sequence ^"&" e*/ws /ws - | Sequence ^"&~" e*/ws /ws +Conjuncts ::= Sequence + | Sequence ^"&" e*/ws /ws + | Sequence ^"&~" e*/ws /ws ps ::= e*/ws => "ps" - | (e+/ws ws)? "^" Quoted (ws e+/ws)? => "ps2" + | (e+/ws !ws)? ^"^" Quoted (!ws e+/ws)? psy ::= ps - | ps wp ^"/" ws e + | ps !wp ^"/" !ws e psx ::= psy => "psy" -// | e "<-" psy /ws => "psyl" - | psy "->" e /ws => "psyr" -// | e "<-" psy "->" e /ws => "psylr" + | psy ^"->" e /ws Sequence ::= Quoted => "qprod" > psx => "psx" | psx "=>" ^"[]" /ws - | psx ^"=>" (word|Quoted) /ws + | psx ^"=>" ("()"|word|Quoted) /ws ec ::= ~[\-\]\\] | escaped @@ -41,15 +40,13 @@ e ::= word => "nonTerminal" | (e ^"++/" e /ws > e ^"+/" e /ws) | (e ^"**" /ws > e ^"*" /ws) | (e ^"**/" e /ws > e ^"*/" e /ws) + | ^"!" e /ws | e ^"?" /ws | "(" word ^")" /ws - > ^"(" alternatives ")" /ws + > ^"(" RHS ")" /ws | ^"~" e -w !::= " " - | "\n" - | "\r" word ::= [a-zA-Z0-9_]++ Quoted ::= "\"" ((~[\"\\] | escaped)+) "\"" | "\"\"" => ""