isac-java/src/java/isac/gui/mawen/editor/TransformAstUtil.scala
changeset 5199 3799cb07f123
parent 5171 9e3daff2688d
child 5203 8fcdb69044d9
     1.1 --- a/isac-java/src/java/isac/gui/mawen/editor/TransformAstUtil.scala	Wed Sep 06 12:50:24 2017 +0200
     1.2 +++ b/isac-java/src/java/isac/gui/mawen/editor/TransformAstUtil.scala	Wed Sep 06 13:45:58 2017 +0200
     1.3 @@ -10,44 +10,28 @@
     1.4   */
     1.5  object TransformAstUtil {
     1.6    
     1.7 -  
     1.8 -  //TODOWN remove stuff for tests
     1.9 -  def a() = Variable("a")
    1.10 -  def b() = Appl(List(Constant("+"), Variable("a"), Variable("b")))
    1.11 -  
    1.12 -  
    1.13    def AstToCursor(ast : Ast) = ast match {
    1.14      case Constant("GAP")      =>  Appl(List(Constant("CURSOR"), ast))
    1.15      case Variable(str)        =>  Appl(List(ast, Constant("CURSOR")))
    1.16      case Constant(str)        =>  Appl(List(ast, Constant("CURSOR")))
    1.17      case Appl(asts)           =>  Appl(List(ast, Constant("CURSOR")))
    1.18    }
    1.19 -  
    1.20 -  
    1.21    def ReplaceCursor(newCursor: Ast)(ast: Ast) = ast match {
    1.22      case  Appl(List(Constant("CURSOR"), a)) => newCursor
    1.23      case  Appl(List(a, Constant("CURSOR"))) => newCursor
    1.24 -    
    1.25    }
    1.26 -  
    1.27    def CursorToAst(ast : Ast) =  ast match {
    1.28      case Appl(List(Constant("CURSOR"), a)) => a
    1.29      case Appl(List(a, Constant("CURSOR"))) => a
    1.30      case _ =>  throw new AstException("CursorToAst, Cursor has a false structure(required: Appl(List(Constant(\"CURSOR\"), ast), get: " + raw_string_of(ast) + ")")
    1.31    }
    1.32 -  
    1.33    def Delete(ast : Ast) = Constant("GAP")
    1.34 -  
    1.35    def Box(ast: Ast) = Appl(List(Constant("BOX.MAIN.0"), ast))
    1.36    
    1.37    def UnBox(ast: Ast) = ast match {
    1.38       case Appl(List(Constant(str), a)) if str.startsWith("BOX") => a
    1.39       case _ =>  throw new AstException("UnBox, Box has a false structure(required: Appl(List(Constant(\"BOX.1\"), ast), get: " + raw_string_of(ast) + ")")
    1.40    }
    1.41 -  
    1.42 -  
    1.43 -  
    1.44 -  
    1.45    def BoxNextChild(c: AstContainer) = {
    1.46       val boxAst = AstInfoUtil.FindBox(c.getAst())
    1.47       if (boxAst != null) {// check if there is a box
    1.48 @@ -83,7 +67,6 @@
    1.49         }
    1.50       }
    1.51    }
    1.52 -  
    1.53    def CursorNextChild(c: AstContainer) = {
    1.54       val boxAst = AstInfoUtil.FindCursor(c.getAst())
    1.55       if (boxAst != null) {
    1.56 @@ -119,11 +102,7 @@
    1.57         }
    1.58       }
    1.59    }
    1.60 -  
    1.61 -  
    1.62 -  
    1.63    def Update(root : Ast, replace : Ast, updatefunc: Ast => Ast ) : Ast = root match {
    1.64 -    
    1.65      case Appl(List(a))                                             if  a eq replace                              => Appl(List(updatefunc(replace)))
    1.66      case Appl(a :: param)                                          if  a eq replace                              => Appl(List(updatefunc(replace)) :::  param)
    1.67      case Appl(param :: a :: Nil)                                   if  a eq replace                              => Appl(param :: List(updatefunc(replace)) )
    1.68 @@ -141,7 +120,6 @@
    1.69      case a => {      
    1.70        return a
    1.71      }
    1.72 -    
    1.73    }
    1.74    
    1.75  }
    1.76 \ No newline at end of file