X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=tests%2Fmeta.g;h=3227dca94baf0b6eec65ca42c68e0f820a3411a2;hb=665d5abdf0269ef5bd4cc4b93bb82b3f74bb0110;hp=b1fb352417b934725976b9d64399d4255b61a0c8;hpb=2244708b6521e2ee6ac89e24887119abda93da3a;p=sbp.git diff --git a/tests/meta.g b/tests/meta.g index b1fb352..3227dca 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,55 +1,49 @@ -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 (!wp "/" !ws e)? => "ps2" +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 + | "^" Quoted /ws => caret + + | "(" word ^")" /ws + > ^"(" RHS ")" /ws + | ^"~" e word ::= [a-zA-Z0-9_]++ Quoted ::= "\"" ((~[\"\\] | escaped)+) "\"" @@ -59,3 +53,7 @@ escaped ::= "\\n" => "\n" | "\\" ~[nr] +w ::= " " | "\n" | "\r" +ws ::= w** => () + | w** "//" ~[\n]* "\n" ws => () +wp ::= w++