equal
deleted
inserted
replaced
3 case object ONE extends Rexp |
3 case object ONE extends Rexp |
4 case class CHAR(c: Char) extends Rexp |
4 case class CHAR(c: Char) extends Rexp |
5 case class ALT(r1: Rexp, r2: Rexp) extends Rexp |
5 case class ALT(r1: Rexp, r2: Rexp) extends Rexp |
6 case class SEQ(r1: Rexp, r2: Rexp) extends Rexp |
6 case class SEQ(r1: Rexp, r2: Rexp) extends Rexp |
7 case class STAR(r: Rexp) extends Rexp |
7 case class STAR(r: Rexp) extends Rexp |
8 case class RANGE(cs: List[Char]) extends Rexp |
|
9 case class PLUS(r: Rexp) extends Rexp |
|
10 case class OPT(r: Rexp) extends Rexp |
|
11 case class NTIMES(r: Rexp, n : Int) extends Rexp |
|
12 case class NMTIMES(r: Rexp, n : Int, m : Int) extends Rexp |
|
13 |
|
14 |
8 |
15 // nullable function: tests whether the regular |
9 // nullable function: tests whether the regular |
16 // expression can recognise the empty string |
10 // expression can recognise the empty string |
17 def nullable (r: Rexp) : Boolean = r match { |
11 def nullable (r: Rexp) : Boolean = r match { |
18 case ZERO => false |
12 case ZERO => false |