added if-then-else dangling testcase
[sbp.git] / tests / regression.tc
index af600f3..cbb50ce 100644 (file)
@@ -359,3 +359,15 @@ testcase {
     z = a:: "a"
 }
 
+testcase {
+    input  "if (x) if (y) z else q";
+    output "if:{ident:{{x}} else:{if:{ident:{{y}} then:{ident:{{z}}}} ident:{{q}}}}";
+
+    s      = e
+    Expr   = if::     "if" "(" Expr ")" IfBody     /ws
+           | ident::  [a-z]++
+    IfBody = else::   Expr             "else" Expr /ws
+           | then::   Expr &~     ~[]* "else" Expr /ws
+    ws     = [ ]**
+}
+