X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=tests%2Fmeta.g;h=d11981b5d8890588c9b874536c863f54684870cb;hb=f1321301726919a74918c3f09e58e78f66017644;hp=4cc100b451f154a7aa895bbf37ce6e7a180e0910;hpb=803319e1a90376c44262ae784b43453c763e7b7d;p=sbp.git diff --git a/tests/meta.g b/tests/meta.g index 4cc100b..d11981b 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,60 +1,62 @@ -s ::= ws grammar ws => "gram" -ws !::= w** -grammar ::= R+/ws => "grammar" -Grammar ::= R+ => "grammar" -R ::= word ^"::=" Alternatives - | word ^"!::=" Alternatives - -ec ::= [~\]\\\-\~] | escaped - -Alternatives ::= EquiAlt +/ ">" -EquiAlt ::= Conjuncts +/ "|" => "alternatives" - -sequence ::= Es - > Es ^"/" E /ws -Es ::= E+ -//es ::= E+/ws - -Conjuncts ::= rewrite - | rewrite ^"&" sequence - | rewrite ^"&~" sequence - -rewrite ::= sequence /ws => "rewrite" - | sequence ^"=>" word /ws - | sequence ^"=>" quoted /ws - | sequence "=>" "()" /ws => "wrap" - -range ::= ec => "range0" | ec ^"-" ec => "range0" -E ::= word => "nonTerminalY" - | [(][)] => "epsilon" - | ^"{" Alternatives "}" - | "[" [\~]? range* "]" => "range" - | E ^"*/" E - | E ^"+/" E - | E ^"?" - | E ^"~/~" - - | E ^"-" E - - | ^"!" E - | "^" quoted => "care" - | ^"`" E - | E ^"#" - | quoted => "literal" - - | (E ^"**" > E ^"*") - | (E ^"++" > E ^"+") - - | "(" word ^")" - > ^"(" Alternatives ")" - -w !::= " " - | "//" [~\n]* "\n" +s ::= Grammar ws => "gram" +w ::= " " | "\n" | "\r" -an ::= [a-zA-Z0-9_] -word ::= an++ => "sify" -quoted ::= "\"" ([~\"\\] | escaped)* "\"" => "sify" +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) + +Conjuncts ::= Sequence + | Sequence ^"&" e*/ws /ws + | Sequence ^"&~" e*/ws /ws + +ps ::= e*/ws => "ps" + | (e+/ws !ws)? "^" Quoted (!ws e+/ws)? => "ps2" +psy ::= ps + | ps !wp ^"/" !ws e +psx ::= psy => "psy" +// | e "<-" psy /ws => "psyl" + | psy "->" e /ws => "psyr" +// | e "<-" psy "->" e /ws => "psylr" +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 + > ^"(" alternatives ")" /ws + | ^"~" e + +word ::= [a-zA-Z0-9_]++ +Quoted ::= "\"" ((~[\"\\] | escaped)+) "\"" + | "\"\"" => "" escaped ::= "\\n" => "\n" | "\\r" => "\r" - | "\\" [~nr] + | "\\" ~[nr] + +