X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fmeta.g;h=5dafc7d42224140d1ce4c37eb70a2b79e360d0a0;hb=8991d0265d2d0ded4b7a680fcc2a6794c95d9f01;hp=349be330fb6f69577a6aee8ce71ed8fd7c5113b9;hpb=e94712936f420a315c2a1db2c2e9e838c58a35cc;p=sbp.git diff --git a/tests/meta.g b/tests/meta.g index 349be33..5dafc7d 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -2,54 +2,50 @@ s ::= Grammar ws => "gram" Grammar ::= NonTerminal +/ ws => "grammar" NonTerminal ::= word ^"::=" RHS /ws -w ::= " " | "\n" | "\r" -ws ::= w** => () - | w** "//" ~[\n]* "\n" ws => () -wp ::= w++ - -RHS ::= (Conjuncts +/ (!ws "|" !ws)) +/ (!ws ">" !ws) - -Conjuncts ::= Sequence - | Sequence ^"&" e*/ws /ws - | Sequence ^"&~" e*/ws /ws - -ps ::= e*/ws => "ps" - | (e+/ws !ws)? ^"^" Quoted (!ws e+/ws)? -psy ::= ps - | ps !wp ^"/" !ws e -psx ::= psy => "psy" - | psy ^"->" e /ws -Sequence ::= Quoted => "qprod" - > psx => "psx" - | psx "=>" ^"[]" /ws - | psx ^"=>" ("()"|word|Quoted) /ws - -ec ::= ~[\-\]\\] - | escaped - -Range ::= ec => "range" - | ec ^"-" ec - -e ::= word => "nonTerminal" - | Quoted => "literal" - | ^"()" - | ^"{" Sequence "}" /ws - | ^"[" Range* "]" - - | e ^"++" /ws -> ~[/] - | e ^"+" /ws -> ~[+] - | e ^"++/" e /ws - | e ^"+/" e /ws - | e ^"**" /ws -> ~[/] - | e ^"*" /ws -> ~[*] - | e ^"**/" e /ws - | e ^"*/" e /ws - | ^"!" e /ws - | e ^"?" /ws - - | "(" word ^")" /ws - > ^"(" RHS ")" /ws - | ^"~" e +RHS ::= (Conjuncts +/ (!ws "|" !ws)) +/ (!ws ">" !ws) + +Conjuncts ::= Sequence + | Sequence ^"&" Elements /ws + | Sequence ^"&~" Elements /ws +Elements ::= e*/ws + +ps ::= Elements => "ps" + | (e+/ws !ws)? ^"^" Quoted (!ws e+/ws)? +psy ::= ps + | ps !wp ^"/" !ws e +psx ::= psy => "psy" + | psy ^"->" e /ws +Sequence ::= Quoted => "qprod" + > psx => "psx" + | psx "=>" ^"[]" /ws + | psx ^"=>" ("()"|word|Quoted) /ws + +ec ::= ~[\-\]\\] + | escaped + +Range ::= ec => "range" + | ec ^"-" ec + +e ::= word => "nonTerminal" + | Quoted => "literal" + | ^"()" + | ^"{" Sequence "}" /ws + | ^"[" Range* "]" + + | e ^"++" /ws -> ~[/] + | e ^"+" /ws -> ~[+] + | e ^"++/" e /ws + | e ^"+/" e /ws + | e ^"**" /ws -> ~[/] + | e ^"*" /ws -> ~[*] + | e ^"**/" e /ws + | e ^"*/" e /ws + | ^"!" e /ws + | e ^"?" /ws + + | "(" word ^")" /ws + > ^"(" RHS ")" /ws + | ^"~" e word ::= [a-zA-Z0-9_]++ Quoted ::= "\"" ((~[\"\\] | escaped)+) "\"" @@ -59,3 +55,7 @@ escaped ::= "\\n" => "\n" | "\\" ~[nr] +w ::= " " | "\n" | "\r" +ws ::= w** => () + | w** "//" ~[\n]* "\n" ws => () +wp ::= w++