X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fmeta.g;h=21597fd546ef4dd2bd3c997c3a8b6c9c7990af13;hb=4160ca39d91856b7baf89014cae80ef91a67dc45;hp=e5a17b5811965c7a047f4cb00fb49bb9134819ca;hpb=d5c3c362cd2cf6780d5bbf8a8f945de768a16503;p=sbp.git diff --git a/tests/meta.g b/tests/meta.g index e5a17b5..21597fd 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,59 +1,66 @@ s ::= ws grammar ws => "gram" ws !::= w** -grammar ::= r+/ws => "grammar" +grammar ::= r +/ ws => "grammar" r ::= word ^"::=" alternatives /ws | word ^"!::=" alternatives /ws -ec ::= [~\]\\\-\~] | escaped +alternatives ::= equiAlt +/ (ws ">" ws) +equiAlt ::= conjuncts +/ (ws "|" ws) => "alternatives" -alternatives ::= EquiAlt +/ (ws ">" ws) -EquiAlt ::= Conjuncts +/ "|" => "alternatives" +sequence ::= es + > es ws ^"/" e +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] + +