+ 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]
+}
+
+// make sure follow restrictions are honored
+// when a string matches the empty string
+testcase {
+ input "xxx";
+ s = x:: "x" A "x" C "x"
+ A = B
+ B = "y"
+ | () -> ~"x"
+ C = D -> ~"x"
+ D = ()
+}
+
+testcase {
+ 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 {
+ input "aaaaaaaaaaaaaaaaaaaa";
+ output "";
+ s = As & AAs
+ As = () | As "a"
+ AAs = () | AAs "aa"
+}
+
+// pathological O(n^2) behavior
+testcase {
+ input "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
+ output "x";
+ s = x:: ManyA!
+ ManyA = ()
+ | x:: A ManyA
+ A = ()! ("a" & ManyAB)
+ ManyAB = ()
+ | "a" ManyAB
+ | "b" ManyAB
+
+}
+
+// another O(n^2) example, tickles different epsilon behaviors
+testcase {
+ input "aaaa";
+ output "x:{x:{x:{x}}}";
+ s = x:: s A! | ()
+ A = "a" & B
+ B = () | B "a"