Package org.rascalmpl.ast

Examples of org.rascalmpl.ast.Statement


    Name dummy = ASTBuilder.make("Name","Lexical",loc, "_");
    Expression var = ASTBuilder.make("Expression","QualifiedName",loc, ASTBuilder.make("QualifiedName", loc, Arrays.asList(dummy)));
    Expression truth = ASTBuilder.make("Expression","Literal",loc, ASTBuilder.make("Literal","Boolean",loc, ASTBuilder.make("BooleanLiteral","Lexical",loc, "true")));
    Expression list = ASTBuilder.make("Expression","List", loc, Arrays.asList(truth));
    Expression enumerator = ASTBuilder.make("Expression","Enumerator",loc, var, list);
    Statement stat = ASTBuilder.make("Statement","For",loc, ASTBuilder.make("Label","Default", loc, label), Arrays.asList(enumerator), body);
    return stat;
  }
View Full Code Here



  public Statement convert(org.rascalmpl.ast.StringLiteral str) {
    final Name label= ASTBuilder.make("Name","Lexical", str.getLocation(), "#" + labelCounter);
    labelCounter++;
    Statement stat = str.accept(new Visitor(label));
    return surroundWithSingleIterForLoop(str.getLocation(), label, stat);
  }
View Full Code Here

    }
   
    @Override
    public Statement visitStringLiteralInterpolated(
        org.rascalmpl.ast.StringLiteral.Interpolated x) {
      Statement pre = x.getPre().accept(this);
      Statement exp = makeIndentingAppend(x.getExpression());
      Statement tail = x.getTail().accept(this);
      return makeBlock(x.getLocation(), pre, exp, tail);
    }
View Full Code Here

    }
   
    @Override
    public Statement visitStringLiteralTemplate(
        org.rascalmpl.ast.StringLiteral.Template x) {
      Statement pre = x.getPre().accept(this);
      Statement template = x.getTemplate().accept(this);
      Statement tail = x.getTail().accept(this);
      return makeBlock(x.getLocation(), pre, template, tail);
    }
View Full Code Here

    }
   
 
    @Override
    public Statement visitStringTemplateDoWhile(DoWhile x) {
      Statement body = x.getBody().accept(this);
      return ASTBuilder.makeStat("DoWhile", x.getLocation(), ASTBuilder.make("Label","Empty", x.getLocation()),
          combinePreBodyPost(x.getLocation(), x.getPreStats(), body, x.getPostStats()) , x.getCondition());
    }
View Full Code Here

          combinePreBodyPost(x.getLocation(), x.getPreStats(), body, x.getPostStats()) , x.getCondition());
    }

    @Override
    public Statement visitStringTemplateFor(For x) {
      Statement body = x.getBody().accept(this);
      return ASTBuilder.makeStat("For", x.getLocation(), ASTBuilder.make("Label","Empty", x.getLocation()), x.getGenerators(),
          combinePreBodyPost(x.getLocation(), x.getPreStats(), body, x.getPostStats()));
    }
View Full Code Here

          combinePreBodyPost(x.getLocation(), x.getPreStats(), body, x.getPostStats()));
    }

    @Override
    public Statement visitStringTemplateIfThen(IfThen x) {
      Statement body = x.getBody().accept(this);
      return ASTBuilder.makeStat("IfThen", x.getLocation(), ASTBuilder.make("Label", "Empty", x.getLocation()), x.getConditions(),
          combinePreBodyPost(x.getLocation(), x.getPreStats(), body, x.getPostStats()));
    }
View Full Code Here

          combinePreBodyPost(x.getLocation(), x.getPreStats(), body, x.getPostStats()));
    }

    @Override
    public Statement visitStringTemplateIfThenElse(IfThenElse x) {
      Statement t = x.getThenString().accept(this);
      Statement e = x.getElseString().accept(this);
      return ASTBuilder.makeStat("IfThenElse", x.getLocation(), ASTBuilder.make("Label","Empty",x.getLocation()),
          x.getConditions(),
            combinePreBodyPost(x.getLocation(), x.getPreStatsThen(), t, x.getPostStatsThen()),
            combinePreBodyPost(x.getLocation(), x.getPreStatsElse(), e, x.getPostStatsElse()));
    }
View Full Code Here

            combinePreBodyPost(x.getLocation(), x.getPreStatsElse(), e, x.getPostStatsElse()));
    }

    @Override
    public Statement visitStringTemplateWhile(While x) {
      Statement body = x.getBody().accept(this);
      return ASTBuilder.makeStat("While", x.getLocation(), ASTBuilder.make("Label","Empty", x.getLocation()), Collections.singletonList(x.getCondition()),
          combinePreBodyPost(x.getLocation(), x.getPreStats(), body, x.getPostStats()));
    }
View Full Code Here

          combinePreBodyPost(x.getLocation(), x.getPreStats(), body, x.getPostStats()));
    }

    @Override
    public Statement visitStringMiddleInterpolated(Interpolated x) {
      Statement mid = x.getMid().accept(this);
      Statement exp = makeIndentingAppend(x.getExpression());
      Statement tail = x.getTail().accept(this);
      return makeBlock(x.getLocation(), mid, exp, tail);
    }
View Full Code Here

TOP

Related Classes of org.rascalmpl.ast.Statement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.