X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=tests%2Fmeta.g;h=092cb9ebc5d426f9af5a80d9a5066836091def3f;hp=05f3abf3eede6dd94a278fff579bc85da1f14239;hb=6470b3188790f3461508a9f290d70c344c6fedf2;hpb=ca2a2375abf048fac4050c1c2551eef551477f94 diff --git a/tests/meta.g b/tests/meta.g index 05f3abf..092cb9e 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,59 +1,67 @@ s ::= ws grammar ws => "gram" ws !::= w** -grammar ::= r+/ws => "grammar" -r ::= word ^"::=" Alternatives /ws - | word ^"!::=" Alternatives /ws +grammar ::= r $$ ws => "grammar" +r ::= word ^"::=" alternatives /ws + | word ^"!::=" alternatives /ws -ec ::= [~\]\\\-\~] | escaped +alternatives ::= equiAlt $$ (ws ">" ws) +equiAlt ::= conjuncts $$ (ws "|" ws) => "alternatives" -Alternatives ::= EquiAlt +/ ">" -EquiAlt ::= Conjuncts +/ "|" => "alternatives" +sequence ::= es + > Es ws ^"/" e +Es ::= e %% (w**) +es ::= e %% (w**) -sequence ::= Es - > Es ^"/" E /ws -Es ::= E+ -//es ::= E+/ws +ss ::= es | es ^"/" e /ws -Conjuncts ::= rewrite - | rewrite ^"&" sequence - | rewrite ^"&~" sequence +conjuncts ::= rewrite + | rewrite ^"&" e%%ws /ws + | rewrite ^"&~" e%%ws /ws rewrite ::= sequence /ws => "rewrite" | sequence ^"=>" word /ws | sequence ^"=>" quoted /ws | sequence "=>" "()" /ws => "wrap" -range ::= ec => "range0" | ec ^"-" ec => "range0" -E ::= word => "nonTerminalY" +ec ::= [~\-\]\\\~] + | escaped + +range ::= ec => "range0" + | ec ^"-" ec => "range1" + +e ::= word => "nonTerminalY" | [(][)] => "epsilon" - | ^"{" Alternatives "}" - | "[" [\~]? range* "]" => "range" - | E ^"*/" E - | E ^"+/" E - | E ^"?" - | E ^"~/~" - - | E ^"-" E - - | ^"!" E - | "^" quoted => "care" - | ^"`" E - | E ^"#" + | ^"{" alternatives "}" /ws + | "[" (range*) "]" => "range" + | "[~" (range*) "]" => "rangex" + | e ^"%%" e /ws + | e ^"$$" e /ws + | e ^"?" /ws + | e ^"~/~" /ws + + | e ^"-" e /ws + + | ^"!" e /ws + | "^" quoted /ws => "care" + | ^"`" e /ws + | e ^"#" /ws | quoted => "literal" - | (E ^"**" > E ^"*") - | (E ^"++" > E ^"+") + | (e ws ^"**" > e ws ^"*") + | (e ws ^"++" > e ws ^"+") - | "(" word ^")" - > ^"(" Alternatives ")" + | "(" word ^")" /ws + > ^"(" alternatives ")" /ws w !::= " " - | "//" [~\n]* "\n" + | "//" ([~\n]*) "\n" | "\n" | "\r" an ::= [a-zA-Z0-9_] word ::= an++ => "sify" -quoted ::= "\"" ([~\"\\] | escaped)* "\"" => "sify" +quoted ::= "\"" (([~\"\\] | escaped)*) "\"" => "sify" escaped ::= "\\n" => "\n" | "\\r" => "\r" | "\\" [~nr] + +