progs/scala/re.scala
changeset 312 8b0b414e71b0
parent 211 0fa636821349
equal deleted inserted replaced
311:8b8db9558ecf 312:8b0b414e71b0
    17 case class Sequ(v1: Val, v2: Val) extends Val
    17 case class Sequ(v1: Val, v2: Val) extends Val
    18 case class Left(v: Val) extends Val
    18 case class Left(v: Val) extends Val
    19 case class Right(v: Val) extends Val
    19 case class Right(v: Val) extends Val
    20 case class Stars(vs: List[Val]) extends Val
    20 case class Stars(vs: List[Val]) extends Val
    21 case class Rec(x: String, v: Val) extends Val
    21 case class Rec(x: String, v: Val) extends Val
       
    22 
    22    
    23    
    23 // some convenience for typing in regular expressions
    24 // some convenience for typing in regular expressions
    24 def charlist2rexp(s : List[Char]): Rexp = s match {
    25 def charlist2rexp(s : List[Char]): Rexp = s match {
    25   case Nil => ONE
    26   case Nil => ONE
    26   case c::Nil => CHAR(c)
    27   case c::Nil => CHAR(c)