author | cu |
Wed, 18 Oct 2017 12:33:00 +0100 | |
changeset 523 | 25e74e6fe2f7 |
parent 522 | 65bef2eccd42 |
child 524 | 3acec8c93c4b |
progs/re3.scala | file | annotate | diff | comparison | revisions |
--- 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