+testcase {
+ input "if (x) if (y) z else q";
+ output "if:{ident:{{x}} else:{if:{ident:{{y}} then:{ident:{{z}}}} ident:{{q}}}}";
+
+ s = Expr
+ Expr = if:: "if" "(" Expr ")" IfBody /ws
+ | ident:: [a-z]++
+ IfBody = else:: Expr "else" Expr /ws
+ | then:: Expr &~ ((~[])* "else" !Expr /ws)
+ ws = [ ]**
+}
+
+
+testcase {
+ input "12111211";
+ output "ac:{{2 1 2 1}}";
+ //output "a:{{2 1 2 1}}";
+ //output "c:{{c:{1 1} c:{1 1}}}";
+
+ s = ab:: ab
+ | ac:: ac
+ | bc:: bc
+ //| a => "a"
+ //| b => "b"
+ //| c => "c"
+ ab = a & b
+ ac = a & c
+ bc = b & c
+ a = ("1" x)*
+ b = ("b":: x "2")*
+ c = ("c":: x "2" x "1")*
+ x = [123]
+}
+
+testcase {
+ input "if (bar!) baz!;";
+ output "IfThen:{id:{x:{b x:{a r}}} id:{x:{b x:{a z}}}}";
+
+ s = Expr ";"
+ Expr = IfThen
+ | IfThenElse
+ | id:: id "!"
+ id = [a-z] | x:: [a-z] id
+ IfThen = IfThen::
+ "if" "(" Expr ")"
+ Expr
+ /ws
+ IfThenElse = IfThenElse::
+ "if" "(" Expr ")"
+ NotIfThenExpr
+ "else"
+ Expr
+ /ws
+ NotIfThenExpr = (Expr & [a-z]+)
+ SpaceIfThen = (~[])*// !IfThen
+ ws = [\n ]**
+}
\ No newline at end of file