X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=tests%2Fmeta.g;h=d11981b5d8890588c9b874536c863f54684870cb;hb=f1321301726919a74918c3f09e58e78f66017644;hp=13a2c4be53426c9c2e8b9d8faf79e8f3d40c1022;hpb=6f3403873375ea351d7d85b5991c133582a29559;p=sbp.git diff --git a/tests/meta.g b/tests/meta.g index 13a2c4b..d11981b 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,21 +1,25 @@ s ::= Grammar ws => "gram" -ws !::= w** | w** "//" (~[\n]*) "\n" ws -wp !::= w++ +w ::= " " + | "\n" + | "\r" +ws ::= w** => () + | w** "//" (~[\n]*) "\n" ws => () +wp ::= w++ Grammar ::= r +/ ws => "grammar" r ::= word ^"::=" alternatives /ws | word ^"!::=" alternatives /ws -alternatives ::= (Conjuncts +/ (ws "|" ws)) +/ (ws ">" ws) +alternatives ::= (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)? => "ps2" psy ::= ps - | ps wp ^"/" ws e + | ps !wp ^"/" !ws e psx ::= psy => "psy" // | e "<-" psy /ws => "psyl" | psy "->" e /ws => "psyr" @@ -23,7 +27,7 @@ psx ::= psy => "psy" Sequence ::= Quoted => "qprod" > psx => "psx" | psx "=>" ^"[]" /ws - | psx ^"=>" (word|Quoted) /ws + | psx ^"=>" ("()"|word|Quoted) /ws ec ::= ~[\-\]\\] | escaped @@ -41,15 +45,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 | ^"~" e -w !::= " " - | "\n" - | "\r" word ::= [a-zA-Z0-9_]++ Quoted ::= "\"" ((~[\"\\] | escaped)+) "\"" | "\"\"" => ""