changeset 523 | 25e74e6fe2f7 |
parent 519 | 955d5b3b0619 |
child 544 | 748207ad3ef0 |
--- a/progs/re3.scala Wed Oct 18 11:02:44 2017 +0100 +++ b/progs/re3.scala Wed Oct 18 12:33:00 2017 +0100 @@ -11,6 +11,12 @@ case class SEQ(r1: Rexp, r2: Rexp) extends Rexp case class STAR(r: Rexp) extends Rexp case class NTIMES(r: Rexp, n: Int) extends Rexp +case class CSET(cs: Set[Char]) extends Rexp +case class CFUN(f: Char => Bool) extends Rexp + +CSET(('a' to 'z').toSet) + +val CSET2(cs: Set[Char]) = CFUN((c:Char) => cs.contains(c)) // nullable function: tests whether the regular