--- a/lex_blex_Frankensteined.scala Sun May 05 22:02:29 2019 +0100
+++ b/lex_blex_Frankensteined.scala Wed May 08 22:09:59 2019 +0100
@@ -415,7 +415,7 @@
def flats_vsimp(rs: List[ARexp], position: Int): Int = (rs, position) match {
case (_, 0) => 0
case (Nil, _) => 0
- case (ZERO :: rs1, _) => flats_vsimp(rs1, position - 1) - 1
+ case (AZERO :: rs1, _) => flats_vsimp(rs1, position - 1) - 1
case (AALTS(bs, rs1) :: rs2, _) => rs1.length - 1 + flats_vsimp(rs2, position - 1)
case (r1 :: rs2, _) => flats_vsimp(rs2, position - 1)
}
@@ -448,29 +448,29 @@
//case ASTAR(bs, r) => ASTAR(bs, bsimp(r))
case r => r
}
- def find_pos(v: Val, rs: List[Rexp]): Int = (rs, v) match{
+ def find_pos(v: Val, rs: List[Rexp]): Int = (v, rs) match{
case (Right(v), r::Nil) => 1
case (Left(v), r::rs) => 0
case (Right(v), r::rs) => find_pos(v, rs) + 1
case (v, _) => 0
}
- def remove(v: Val, rs: List[Rexp]) : Val = (rs,v) match {//remove the outmost layer of ALTS's Left and Right
+ def remove(v: Val, rs: List[Rexp]) : Val = (v,rs) match {//remove the outmost layer of ALTS's Left and Right
case (Right(v), r::Nil) => v
case (Left(v), r::rs) => v
case (Right(v), r::rs) => remove(v, rs)
}
- def simple_end(v: Value): Boolean = v match {
+ def simple_end(v: Val): Boolean = v match {
case Left(v) => return false
case Right(v) => return simple_end(v)
case v => return true
}
- def isend(v: Val, rs: List[Rexp], position: Int): Boolean = {
+ def isend(v: Val, rs: List[ARexp], position: Int): Boolean = {
val rsbh = rs.slice(position, rs.length)
val out_end = if(flats(rsbh) == Nil) true else false
val inner_end = simple_end(v)
inner_end && out_end
}
- def get_coat(v: Val, rs: List[Rexp], vs: Val): Val = (rs, v) match{//the dual operation of remove(so-called by myself)
+ def get_coat(v: Val, rs: List[Rexp], vs: Val): Val = (v, rs) match{//the dual operation of remove(so-called by myself)
case (Right(v), r::Nil) => Right(vs)
case (Left(v), r::rs) => Left(vs)
case (Right(v), r::rs) => Right(get_coat(v, rs, vs))
@@ -479,6 +479,7 @@
case 0 => v
case i => coat(Right(v), i - 1)
}
+ /*
def bsimp2(r: ARexp, v: Val): (ARexp, Val => Val) = (r,v) match{
case (ASEQ(bs1, r1, r2), v) => (bsimp2(r1), bsimp2(r2)) match {
case ((AZERO, _), (_, _) )=> (AZERO, undefined)
@@ -510,7 +511,7 @@
}
//case ASTAR(bs, r) => ASTAR(bs, bsimp(r))
case r => r
- }
+ }*/
def super_bsimp(r: ARexp): ARexp = r match {
case ASEQ(bs1, r1, r2) => (super_bsimp(r1), super_bsimp(r2)) match {
case (AZERO, _) => AZERO