+ input "a+2";
+ output "Plus:{left:{Foo} right:{{2}}}";
+
+ s = Expr
+ Expr = "":: [0-9]++
+ | Plus:: (left::Expra) "+" (right::Expr)
+ Expra = Foo:: ("a" | "b")
+
+}
+
+testcase "unnamed" {
+ input "aaaaa";
+ output "top:{a q a}";
+
+ s = top:: z (q::"a"*) z
+ z = a:: "a"
+}
+
+testcase "dangling else" {
+ 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 "unnamed" {
+ input "12111211";
+ output "ac:{{2 1 2 1}}";
+
+ s = ab:: ab
+ | ac:: ac
+ | bc:: bc
+ 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 "follow restrictions on empty string" {
+ input "xxx";
+ s = x:: "x" A "x" C "x"
+ A = B
+ B = "y"
+ | () -> ~"x"
+ C = D -> ~"x"
+ D = ()
+}
+
+testcase "unnamed" {
+ input "axxxxxc";
+ output "q:{a {x x x x x} c}";
+ s = q:: A ws (B|()) ws C
+ ws = "":: [x]**
+ A = a:: "a"
+ B = b:: "b"
+ C = c:: "c"
+}
+
+testcase "unnamed" {
+ input "aaaaaaaaaaaaaaaaaaaa";
+ output "";
+ s = As & AAs
+ As = () | As "a"
+ AAs = () | AAs "aa"
+}
+
+testcase "question mark" {
+ input "aa aba abba";
+ output "s:{Y Y Z}";
+ s = s:: X " " X " " X
+ X = Y > Z
+ Y = Y:: "a" B? "a"
+ Z = Z:: "a" "b"* "a"
+ B = "b"
+}
+
+testcase "operator: ... " {
+ input "aaabbbaaa abababababa";
+ output "s:{C:{a a a b b b a a a} B:{a b a b a b a b a b a}}";
+ s:: = A " " A
+ A = B > C
+ B:: = [ab]* &~ (... "bbb" ...)
+ C:: = [ab]*
+}
+
+testcase "operator: ~~" {
+ input "aaabbbaaa abababababa";
+ output "s:{C:{a a a b b b a a a} B:{a b a b a b a b a b a}}";
+ s:: = A " " A
+ A = B > C
+ B:: = ~~(... "bbb" ...)
+ C:: = [ab]*
+}
+
+testcase "lifts" {
+ input "a+(b*c)";
+ output "+:{a *:{id:{b} c}}";
+
+ s = r
+ r = id
+ | r ^"*" `r
+ | `r ^"+" r
+ | "(" r ")"
+ id:: = [a-z]++
+}
+
+testcase "epsilon as a positive conjunct" {
+ input "abababab";
+ s:: = X*
+ X:: = "a" ("b"+ & ())
+}