X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=tests%2Fmeta.g;h=3c191d41722a1dcd6cc935bc34b50cdad8b97025;hp=f16c60a384c40cc1dd1c3adb2d79607635c93da2;hb=ba93ca53361ed2f7e542ab78fcb3df86597dd9e5;hpb=a4e47e7742e717f9fc72455f60cdbd16a7af9fe1 diff --git a/tests/meta.g b/tests/meta.g index f16c60a..3c191d4 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,51 +1,55 @@ -s ::= w* Grammar w* => "gram" +s ::= ws grammar ws => "gram" ws !::= w** -grammar ::= R+/ws => "grammar" -Grammar ::= R+ => "grammar" -R ::= word ^"::=" Alternatives - | word ^"!::=" Alternatives +grammar ::= r+/ws => "grammar" +r ::= word ^"::=" alternatives /ws + | word ^"!::=" alternatives /ws ec ::= [~\]\\\-\~] | escaped -Alternatives ::= EquiAlt +/ ">" -EquiAlt ::= Conjuncts +/ "|" => "alternatives" +alternatives ::= equiAlt +/ (ws ">" ws) +equiAlt ::= conjuncts +/ (ws "|" ws) => "alternatives" -sequence ::= Es ^"/" E /ws - > Es -Es ::= E+ +sequence ::= Es + > Es ^"/" e /ws +Es ::= e+ +es ::= e+/ws -Conjuncts ::= rewrite - | rewrite ^"&" sequence - | rewrite ^"&~" sequence + +conjuncts ::= rewrite + | rewrite ^"&" sequence /ws + | rewrite ^"&~" sequence /ws rewrite ::= sequence /ws => "rewrite" | sequence ^"=>" word /ws | sequence ^"=>" quoted /ws | sequence "=>" "()" /ws => "wrap" -range ::= ec => "range0" | ec ^"-" ec => "range0" -E ::= word => "nonTerminalY" +range ::= ec => "range0" + | ec ^"-" ec => "range0" + +e ::= word => "nonTerminalY" | [(][)] => "epsilon" - | ^"{" Alternatives "}" + | ^"{" alternatives "}" /ws | "[" [\~]? range* "]" => "range" - | E ^"*/" E - | E ^"+/" E - | E ^"?" - | E ^"~/~" + | e ^"+/" e /ws + | e ^"%%" e /ws + | e ^"$$" e /ws + | e ^"?" /ws + | e ^"~/~" /ws - | E ^"-" E + | e ^"-" e /ws - | ^"!" E - | "^" quoted => "care" - | ^"`" E - | E ^"#" + | ^"!" 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" @@ -57,3 +61,5 @@ quoted ::= "\"" ([~\"\\] | escaped)* "\"" => "sify" escaped ::= "\\n" => "\n" | "\\r" => "\r" | "\\" [~nr] + +