X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=tests%2Fmeta.g;h=e2713f99f3cdad38e79194586a544528836ad6d4;hp=02618abf9de083e27a45c796ec9dbde3697a4e25;hb=3485f1c89ae352b5aa1b65cdfa5f628cd3859601;hpb=f7301c48e0bfb173e837f53d9aa8f30130974807 diff --git a/tests/meta.g b/tests/meta.g index 02618ab..e2713f9 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,7 +20,6 @@ conjuncts ::= rewrite rewrite ::= sequence /ws => "rewrite" | sequence ^"=>" word /ws | sequence ^"=>" quoted /ws - | sequence "=>" "()" /ws => "wrap" ec ::= [~\-\]\\\~] | escaped @@ -28,26 +27,21 @@ ec ::= [~\-\]\\\~] range ::= ec => "range" | ec ^"-" ec -e ::= word => "nonTerminalY" - | [(][)] => "epsilon" +e ::= word => "nonTerminal" + | [(][)] => "epsilon" | ^"{" alternatives "}" /ws | ^"[" (range*) "]" | ^"[~" (range*) "]" - | e ^"+/" e /ws - | e ^"*/" e /ws - | e ^"?" /ws - | e ^"~/~" /ws - - | e ^"-" e /ws - - | ^"!" e /ws | ^"^" quoted /ws - | ^"`" e /ws - | e ^"#" /ws - | quoted => "literal" + | ^"!" e /ws | (e ws ^"**" > e ws ^"*") + | e ^"*/" e /ws | (e ws ^"++" > e ws ^"+") + | e ^"+/" e /ws + | e ^"?" /ws + + | quoted => "literal" | "(" word ^")" /ws > ^"(" alternatives ")" /ws @@ -57,8 +51,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]