X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fmeta.g;h=7afdbc443506e7d7ff4e7f13d0fb1c8b7e4c2a10;hb=fc28000b13f531d55e0509a596ce5ad96c63bbf2;hp=3a7d2f03dde1932f662d69c26e1a115a1404b5de;hpb=1c86fe0488df6c123731f51d8636be37cff583ab;p=sbp.git diff --git a/tests/meta.g b/tests/meta.g index 3a7d2f0..7afdbc4 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,11 +1,11 @@ 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 @@ -20,36 +20,32 @@ conjuncts ::= rewrite rewrite ::= sequence /ws => "rewrite" | sequence ^"=>" word /ws | sequence ^"=>" quoted /ws - | sequence "=>" "()" /ws => "wrap" 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 + | ^"[" (range*) "]" + | ^"[~" (range*) "]" + | ^"^" quoted /ws | e ^"~/~" /ws - - | e ^"-" e /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 +55,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]