equal
deleted
inserted
replaced
16 case class UPNTIMES(r: Rexp, n: Int) extends Rexp // up n-times |
16 case class UPNTIMES(r: Rexp, n: Int) extends Rexp // up n-times |
17 case class FROMNTIMES(r: Rexp, n: Int) extends Rexp // from n-times |
17 case class FROMNTIMES(r: Rexp, n: Int) extends Rexp // from n-times |
18 case class NMTIMES(r: Rexp, n: Int, m: Int) extends Rexp // between nm-times |
18 case class NMTIMES(r: Rexp, n: Int, m: Int) extends Rexp // between nm-times |
19 case class NOT(r: Rexp) extends Rexp // not |
19 case class NOT(r: Rexp) extends Rexp // not |
20 case class CFUN(f: Char => Boolean) extends Rexp // subsuming CHAR and RANGE |
20 case class CFUN(f: Char => Boolean) extends Rexp // subsuming CHAR and RANGE |
|
21 |
|
22 def CHAR(c: Char) = CFUN(d => c == d) |
|
23 val ALL = CFUN(_ => true) |
|
24 def RANGE(cs: Set[Char]) = CFUN(d => cs.contains(d)) |
|
25 |
|
26 def CHAR(c: Char) = CFUN(c == _) |
|
27 val ALL = CFUN(_ => true) |
|
28 def RANGE(cs: Set[Char]) = CFUN(cs.contains(_)) |
21 |
29 |
22 |
30 |
23 // nullable function: tests whether the regular |
31 // nullable function: tests whether the regular |
24 // expression can recognise the empty string |
32 // expression can recognise the empty string |
25 def nullable (r: Rexp) : Boolean = r match { |
33 def nullable (r: Rexp) : Boolean = r match { |