| author | cu |
| Wed, 18 Oct 2017 12:33:00 +0100 | |
| changeset 523 | 9c3db5a99084 |
| parent 522 | 11d6c66e7edf |
| child 524 | e264779c3411 |
| 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