Package com.google.minijoe.compiler.ast

Examples of com.google.minijoe.compiler.ast.Statement


  }

  public Statement visit(TryStatement statement) throws CompilerException {
    addLineNumber(statement);

    Statement saveTryStatement = currentTryStatement;
    String saveTryLabel = currentTryLabel;

    currentTryStatement = statement;
    currentTryLabel = statement.catchBlock != null ? "catch" : "finally";
View Full Code Here


  }

  public Statement visit(WhileStatement statement) throws CompilerException {
    addLineNumber(statement);

    Statement saveBreakStatement = currentBreakStatement;
    Statement saveContinueStatement = currentContinueStatement;

    currentBreakStatement = statement;
    currentContinueStatement = statement;

    setLabel(statement, "continue");
View Full Code Here

      statement.statement.visitStatement(this);
      writeOp(JsFunction.OP_WITH_END);
    } else {
      // if an exception is thrown inside the with statement,
      // it is necessary to restore the context
      Statement saveTryStatement = currentTryStatement;
      String saveTryLabel = currentTryLabel;
      currentTryLabel = "finally";
      currentTryStatement = statement;
      statement.expression.visitExpression(this);
      writeOp(JsFunction.OP_WITH_END);
View Full Code Here

    for (int i = 0; i < variableStatement.declarations.length; i++) {
      Expression expression = visitExpression(variableStatement.declarations[i]);

      if (expression != null) {
        Statement statement = new ExpressionStatement(expression);
        statement.setLineNumber(variableStatement.getLineNumber());
        statements.addElement(statement);
      }
    }

    if (statements.size() == 0) {
View Full Code Here

    return new WhileStatement(expression, statement);
  }

  private Statement parseWithStatement() throws CompilerException {
    Statement statement;
    Expression expression;

    readToken(Token.KEYWORD_WITH);
    readToken(Token.OPERATOR_OPENPAREN);
    expression = parseExpression(true);
View Full Code Here

  }

  public void assertParserOutput(Statement expected, String input) throws CompilerException {
    Lexer lexer = new Lexer(input);
    Parser parser = new Parser(lexer);
    Statement statement = parser.parseSourceElement();

    try {
      // ensure the RoundTripVisitor doesn't complain about this parse tree
      statement.visitStatement(
          new RoundtripVisitor(
              new OutputStreamWriter(
                  new ByteArrayOutputStream()
              )
          )
View Full Code Here

TOP

Related Classes of com.google.minijoe.compiler.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.