equal
deleted
inserted
replaced
9 case class CHAR(c: Char) extends Rexp |
9 case class CHAR(c: Char) extends Rexp |
10 case class ALT(r1: Rexp, r2: Rexp) extends Rexp |
10 case class ALT(r1: Rexp, r2: Rexp) extends Rexp |
11 case class SEQ(r1: Rexp, r2: Rexp) extends Rexp |
11 case class SEQ(r1: Rexp, r2: Rexp) extends Rexp |
12 case class STAR(r: Rexp) extends Rexp |
12 case class STAR(r: Rexp) extends Rexp |
13 case class NTIMES(r: Rexp, n: Int) extends Rexp |
13 case class NTIMES(r: Rexp, n: Int) extends Rexp |
|
14 case class CSET(cs: Set[Char]) extends Rexp |
|
15 case class CFUN(f: Char => Bool) extends Rexp |
|
16 |
|
17 CSET(('a' to 'z').toSet) |
|
18 |
|
19 val CSET2(cs: Set[Char]) = CFUN((c:Char) => cs.contains(c)) |
14 |
20 |
15 |
21 |
16 // nullable function: tests whether the regular |
22 // nullable function: tests whether the regular |
17 // expression can recognise the empty string |
23 // expression can recognise the empty string |
18 def nullable (r: Rexp) : Boolean = r match { |
24 def nullable (r: Rexp) : Boolean = r match { |