equal
deleted
inserted
replaced
14 case object ONE extends Rexp // matches an empty string |
14 case object ONE extends Rexp // matches an empty string |
15 case class CHAR(c: Char) extends Rexp // matches a character c |
15 case class CHAR(c: Char) extends Rexp // matches a character c |
16 case class ALT(r1: Rexp, r2: Rexp) extends Rexp // alternative |
16 case class ALT(r1: Rexp, r2: Rexp) extends Rexp // alternative |
17 case class SEQ(r1: Rexp, r2: Rexp) extends Rexp // sequence |
17 case class SEQ(r1: Rexp, r2: Rexp) extends Rexp // sequence |
18 case class STAR(r: Rexp) extends Rexp // star |
18 case class STAR(r: Rexp) extends Rexp // star |
|
19 |
19 |
20 |
20 // nullable function: tests whether a regular |
21 // nullable function: tests whether a regular |
21 // expression can recognise the empty string |
22 // expression can recognise the empty string |
22 def nullable(r: Rexp) : Boolean = r match { |
23 def nullable(r: Rexp) : Boolean = r match { |
23 case ZERO => false |
24 case ZERO => false |