progs/matcher/re3.sc
changeset 782 a26a20acd1c2
parent 769 f9686b22db7e
child 825 dca072e2bb7d
--- a/progs/matcher/re3.sc	Thu Oct 15 09:22:33 2020 +0100
+++ b/progs/matcher/re3.sc	Sat Oct 17 13:14:19 2020 +0100
@@ -146,3 +146,31 @@
 def all() = { test1(); test2() } 
 
 
+
+
+
+// test: (a + aa)*
+val EVIL3 = STAR(ALT(CHAR('a'), SEQ(CHAR('a'), CHAR('a'))))
+
+// test: (1 + a + aa)*
+val EVIL4 = STAR(ALT(ONE, ALT(CHAR('a'), SEQ(CHAR('a'), CHAR('a')))))
+
+@doc("Test Evil3")
+@main
+def test3() = {
+  println("Test (a + aa)*")
+
+  for (i <- 0 to 35 by 5) {
+    println(f"$i: ${time_needed(1, matcher(EVIL3, "a" * i))}%.5f")
+  }
+}
+
+@doc("Test Evil4")
+@main
+def test4() = {
+  println("Test (1 + a + aa)*")
+
+  for (i <- 0 to 35 by 5) {
+    println(f"$i: ${time_needed(1, matcher(EVIL4, "a" * i))}%.5f")
+  }
+}
\ No newline at end of file