X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=tests%2Fmeta.g;h=fa2b98f03e6e9cd8c9d47b53d9ac153d3b08a3ec;hp=3a7d2f03dde1932f662d69c26e1a115a1404b5de;hb=cb5151d11037144c14809f6516ce5c1f1976ef7f;hpb=1c86fe0488df6c123731f51d8636be37cff583ab diff --git a/tests/meta.g b/tests/meta.g index 3a7d2f0..fa2b98f 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,55 +1,46 @@ s ::= ws grammar ws => "gram" ws !::= w** -grammar ::= r +/ ws => "grammar" +grammar ::= r +/ ws => "grammar" r ::= word ^"::=" alternatives /ws | word ^"!::=" alternatives /ws alternatives ::= equiAlt +/ (ws ">" ws) -equiAlt ::= conjuncts +/ (ws "|" ws) => "alternatives" +equiAlt ::= conjuncts +/ (ws "|" ws) sequence ::= es > es ws ^"/" e es ::= e */ (w**) -ss ::= es | es ^"/" e /ws +ss ::= es => "seq" | es ^"/" e /ws conjuncts ::= rewrite | rewrite ^"&" e*/ws /ws | rewrite ^"&~" e*/ws /ws -rewrite ::= sequence /ws => "rewrite" - | sequence ^"=>" word /ws - | sequence ^"=>" quoted /ws - | sequence "=>" "()" /ws => "wrap" +rewrite ::= sequence /ws => "rewrite" + | sequence ^"=>" (word|quoted) /ws ec ::= [~\-\]\\\~] | escaped -range ::= ec => "range0" - | ec ^"-" ec => "range1" +range ::= ec => "range" + | ec ^"-" ec -e ::= word => "nonTerminalY" - | [(][)] => "epsilon" +e ::= word => "nonTerminal" + | [(][)] => "epsilon" | ^"{" alternatives "}" /ws - | "[" (range*) "]" => "range" - | "[~" (range*) "]" => "rangex" - | e ^"%%" e /ws - | e ^"$$" e /ws - | e ^"+/" e /ws - | e ^"*/" e /ws - | e ^"?" /ws - | e ^"~/~" /ws - - | e ^"-" e /ws - + | ^"[" (range*) "]" + | ^"[~" (range*) "]" + | ^"^" quoted /ws | ^"!" e /ws - | "^" quoted /ws => "care" - | ^"`" e /ws - | e ^"#" /ws - | quoted => "literal" | (e ws ^"**" > e ws ^"*") + | e ^"*/" e /ws | (e ws ^"++" > e ws ^"+") + | e ^"+/" e /ws + | e ^"?" /ws + + | quoted => "literal" | "(" word ^")" /ws > ^"(" alternatives ")" /ws @@ -59,8 +50,9 @@ w !::= " " | "\n" | "\r" an ::= [a-zA-Z0-9_] -word ::= an++ => "sify" -quoted ::= "\"" (([~\"\\] | escaped)*) "\"" => "sify" +word ::= an++ +quoted ::= "\"" (([~\"\\] | escaped)+) "\"" + | "\"\"" => "" escaped ::= "\\n" => "\n" | "\\r" => "\r" | "\\" [~nr]