126 case (ALT(r1, r2), Right(v2)) => Right(inj(r2, c, v2)) |
126 case (ALT(r1, r2), Right(v2)) => Right(inj(r2, c, v2)) |
127 case (CHAR(d), Empty) => Chr(c) |
127 case (CHAR(d), Empty) => Chr(c) |
128 case (RECD(x, r1), _) => Rec(x, inj(r1, c, v)) |
128 case (RECD(x, r1), _) => Rec(x, inj(r1, c, v)) |
129 } |
129 } |
130 |
130 |
131 // lexing functions including simplification |
131 // lexing functions without simplification |
132 def lex(r: Rexp, s: List[Char]) : Val = s match { |
132 def lex(r: Rexp, s: List[Char]) : Val = s match { |
133 case Nil => if (nullable(r)) mkeps(r) else |
133 case Nil => if (nullable(r)) mkeps(r) else |
134 { throw new Exception("lexing error") } |
134 { throw new Exception("lexing error") } |
135 case c::cs => inj(r, c, lex(der(c, r), cs)) |
135 case c::cs => inj(r, c, lex(der(c, r), cs)) |
136 } |
136 } |