-//testcase {
-// input "x";
-// output "a:{x}";
-//
-// s = a1:: a
-// a = s1:: s
-// a = ^"x"
-//}
-//
-//testcase {
-// input "x";
-// output "x";
-// output "s2:{s2:{s0 s0} x}";
-// output "s2:{s0 x}";
-//
-//
-// s = s2:: s s
-// s = ^"x"
-// s = s0:: ()
-//}
-
testcase {
input "aaaaa";
s = A
| "a" A &~ "a" s
}
-//testcase {
-// input "a";
-// output "yes:{}";
-// s = A
-// A = "a" s &~ "a" A
-// | "a" A &~ "a" s
-// | ()
-//}
-
testcase {
input "ab c";
output "1:{{a b} {c}}";
x = ~[]
s = xbx:: x* b x*
b = abab:: [ab][ab]
- &~ ( "aa" | "bb" )
+ &~ ("aa"|"bb")
}
testcase {
idl = [a-d]
}
-//testcase {
-// input "a*b*c";
-// output "times:{stringify:{{a}} times:{stringify:{{b}} stringify:{{c}}}}";
-// w = " "
-// l = id
-// s = l "=" r => "assign"
-// | r
-// r = l
-// | l "=" r => "assign"
-// | r "+" r => "plus"
-// | (r) "*" r => "times"
-// | "(" r ")"
-// | r r => "times"
-// id = idl++ => "stringify"
-// idl = [a-d]
-//}
-
testcase {
input "a+b*c";
output "plus:{stringify:{{a}} times:{stringify:{{b}} stringify:{{c}}}}";
}
-
-
testcase {
input "abc ";
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 "ab";
-//
-// s = a:"a" b:"b"
-//}
+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 "a c";
- s = first:: A WSA B? WSB C
- A = "a"
- B = "b"
- C = "c"
- WSA = WSA:: " "**
- WSB = () -> ~" "
- | WSB:: " "++
+ 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"
+}