lex_blex_Frankensteined.scala
changeset 109 79f347cb8b4d
parent 107 b1e365afa29c
child 148 c8ef391dd6f7
equal deleted inserted replaced
108:0a0c551bb368 109:79f347cb8b4d
   117     case (STAR(_), Z::bs) => (Stars(Nil), bs)
   117     case (STAR(_), Z::bs) => (Stars(Nil), bs)
   118     case (RECD(x, r1), bs) => {
   118     case (RECD(x, r1), bs) => {
   119       val (v, bs1) = decode_aux(r1, bs)
   119       val (v, bs1) = decode_aux(r1, bs)
   120       (Rec(x, v), bs1)
   120       (Rec(x, v), bs1)
   121     }
   121     }
       
   122     case (r, Nil) => (Stars(Nil), Nil)
   122   }
   123   }
   123 
   124 
   124   def decode(r: Rexp, bs: Bits) = decode_aux(r, bs) match {
   125   def decode(r: Rexp, bs: Bits) = decode_aux(r, bs) match {
   125     case (v, Nil) => v
   126     case (v, Nil) => v
   126     case _ => throw new Exception("Not decodable")
   127     case _ => throw new Exception("Not decodable")