X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=tests%2Fmeta.g;h=e7f3524397dc615bd5b252fc60b08f836879e076;hb=d824fe4034e79260f1f065d1040a39571897cd95;hp=b1fb352417b934725976b9d64399d4255b61a0c8;hpb=2244708b6521e2ee6ac89e24887119abda93da3a;p=sbp.git diff --git a/tests/meta.g b/tests/meta.g index b1fb352..e7f3524 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,55 +1,48 @@ -s ::= Grammar ws => "gram" +s ::= !ws 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 + +psy ::= Elements => "ps" + | psy !wp ^"/" !ws e + | psy ^"->" e /ws + | psy "=>" ("[]"|"()"|word|Quoted) /ws => goo +Sequence ::= Quoted => "qprod" + > psy => "psx" + +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 + | ^"^" Quoted /ws + + | "(" word ^")" /ws + > ^"(" RHS ")" /ws + | ^"~" e word ::= [a-zA-Z0-9_]++ Quoted ::= "\"" ((~[\"\\] | escaped)+) "\"" @@ -59,3 +52,7 @@ escaped ::= "\\n" => "\n" | "\\" ~[nr] +w ::= " " | "\n" | "\r" +ws ::= w** => () + | w** "//" ~[\n]* "\n" ws => () +wp ::= w++