X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=tests%2Fmeta.g;h=3c191d41722a1dcd6cc935bc34b50cdad8b97025;hp=7b1595d32d3195063ba75319145966c0715317c9;hb=ba93ca53361ed2f7e542ab78fcb3df86597dd9e5;hpb=b39089b9e525f796a9f31e4707aac5ac0d6cfc3b diff --git a/tests/meta.g b/tests/meta.g index 7b1595d..3c191d4 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,50 +1,55 @@ -s ::= w* Grammar w* => "gram" -ws !::= w* -grammar ::= R+/ws => "grammar" -Grammar ::= R+ => "grammar" -R ::= word ^"::=" Alternatives - | word ^"!::=" Alternatives +s ::= ws grammar ws => "gram" +ws !::= w** +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 ::= E+ ^"/" E - > E+ +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" +conjuncts ::= rewrite + | rewrite ^"&" sequence /ws + | rewrite ^"&~" sequence /ws -range ::= ec => "range0" | ec ^"-" ec => "range0" -E ::= word => "nonTerminalY" +rewrite ::= sequence /ws => "rewrite" + | sequence ^"=>" word /ws + | sequence ^"=>" quoted /ws + | sequence "=>" "()" /ws => "wrap" + +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" @@ -56,3 +61,5 @@ quoted ::= "\"" ([~\"\\] | escaped)* "\"" => "sify" escaped ::= "\\n" => "\n" | "\\r" => "\r" | "\\" [~nr] + +