lex_blex_Frankensteined.scala
changeset 59 8ff7b7508824
parent 17 3241b1e71633
child 92 aaa2f2b52baf
equal deleted inserted replaced
58:f0360e17080e 59:8ff7b7508824
   144     case (AALTS(bs, as), Left(v)) => bs ++ retrieve(as.head,v)
   144     case (AALTS(bs, as), Left(v)) => bs ++ retrieve(as.head,v)
   145     case (AALTS(bs, as), Right(v)) => bs ++ retrieve(AALTS(Nil,as.tail),v)
   145     case (AALTS(bs, as), Right(v)) => bs ++ retrieve(AALTS(Nil,as.tail),v)
   146     case (ASEQ(bs, a1, a2), Sequ(v1, v2)) => bs ++ retrieve(a1, v1) ++ retrieve(a2, v2)
   146     case (ASEQ(bs, a1, a2), Sequ(v1, v2)) => bs ++ retrieve(a1, v1) ++ retrieve(a2, v2)
   147     case (ASTAR(bs, a), Stars(Nil)) => bs ++ List(Z) 
   147     case (ASTAR(bs, a), Stars(Nil)) => bs ++ List(Z) 
   148     case (ASTAR(bs, a), Stars(v::vs)) => bs ++ List(S) ++ retrieve(a, v) ++ retrieve(ASTAR(Nil, a), Stars(vs))
   148     case (ASTAR(bs, a), Stars(v::vs)) => bs ++ List(S) ++ retrieve(a, v) ++ retrieve(ASTAR(Nil, a), Stars(vs))
   149   }
   149   }//bug here last clause should not add list(S)
   150   //erase function: extracts the regx from Aregex
   150   //erase function: extracts the regx from Aregex
   151   def erase(r:ARexp): Rexp = r match{
   151   def erase(r:ARexp): Rexp = r match{
   152     case AZERO => ZERO
   152     case AZERO => ZERO
   153     case AONE(_) => ONE
   153     case AONE(_) => ONE
   154     case ACHAR(bs, f) => CHAR(f)
   154     case ACHAR(bs, f) => CHAR(f)