diff -r ae4708c851ee -r 4fa7231fede7 marking/re2b_test.scala --- a/marking/re2b_test.scala Wed Dec 21 03:06:18 2016 +0000 +++ b/marking/re2b_test.scala Wed Jan 11 12:18:34 2017 +0000 @@ -20,7 +20,7 @@ case CHAR(d) => if (c == d) ONE else ZERO case ALT(r1, r2) => ALT(der_urban(c, r1), der_urban(c, r2)) case SEQ(r1, r2) => - if (nullable(r1)) ALT(SEQ(der_urban(c, r1), r2), der_urban(c, r2)) + if (nullable_urban(r1)) ALT(SEQ(der_urban(c, r1), r2), der_urban(c, r2)) else SEQ(der_urban(c, r1), r2) case STAR(r1) => SEQ(der_urban(c, r1), STAR(r1)) } @@ -41,10 +41,16 @@ case r => r } +import scala.annotation.tailrec + +@tailrec +def iterT_urban[A](n: Int, f: A => A, x: A): A = + if (n == 0) x else iterT_urban(n - 1, f, f(x)) + lazy val f = Future { - assert(size(iterT(20, (r: Rexp) => der_urban('a', r), EVIL_urban)) == 7340068) - assert(size(iterT(20, (r: Rexp) => simp_urban(der_urban('a', r)), EVIL_urban)) == 8) + assert(size(iterT_urban(20, (r: Rexp) => der_urban('a', r), EVIL_urban)) == 7340068) + assert(size(iterT_urban(20, (r: Rexp) => simp_urban(der_urban('a', r)), EVIL_urban)) == 8) } -Await.result(f, 120 second) +Await.result(f, 90 second)