Examples of EmptyStatement


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

      lineNumber = getLineNumber();
    }

    if (nextToken == Token.OPERATOR_SEMICOLON) {
      readToken(Token.OPERATOR_SEMICOLON);
      statement = new EmptyStatement();

    } else if (nextToken == Token.OPERATOR_OPENBRACE) {
      statement = parseBlockStatement();

    } else if (nextToken == Token.KEYWORD_BREAK) {
View Full Code Here

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

  public Statement visit(FunctionDeclaration functionDeclaration) throws CompilerException {
    functionDeclaration = (FunctionDeclaration) super.visit(functionDeclaration);

    functionVector.addElement(new ExpressionStatement(functionDeclaration.literal));

    return new EmptyStatement();
  }
View Full Code Here

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

        statements.addElement(statement);
      }
    }

    if (statements.size() == 0) {
      return new EmptyStatement();
    } else if (statements.size() == 1) {
      return (ExpressionStatement) statements.elementAt(0);
    } else {
      return new BlockStatement(Util.vectorToStatementArray(statements));
    }
View Full Code Here

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

    super(name);
  }

  public void testEmptyStatement() throws CompilerException {
    assertParserOutput(
        new EmptyStatement(
        ),
        ";"
    );
    assertParserOutput(
        new BlockStatement(
            new Statement[] {
                new EmptyStatement()
            }
        ),
        "{;}"
    );
  }
View Full Code Here

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

                    new NumberLiteral(2.0),
                    new NumberLiteral(3.0),
                    new NumberLiteral(4.0)
                }
            ),
            new EmptyStatement()
        ),
        "for (foo in [1, 2, 3, 4]);"
    );
    assertParserOutput(
        new ForInStatement(
            new PropertyExpression(
                new Identifier("foo"),
                new StringLiteral("bar")
            ),
            new ArrayLiteral(
                new Expression[] {
                    new NumberLiteral(1.0),
                    new NumberLiteral(2.0),
                    new NumberLiteral(3.0),
                    new NumberLiteral(4.0)
                }
            ),
            new EmptyStatement()
        ),
        "for (foo.bar in [1, 2, 3, 4]);"
    );
    assertParserOutput(
        new ForInStatement(
            new VariableDeclaration(
                new Identifier("foo"),
                null
            ),
            new ArrayLiteral(
                new Expression[] {
                    new NumberLiteral(1.0),
                    new NumberLiteral(2.0),
                    new NumberLiteral(3.0),
                    new NumberLiteral(4.0)
                }
            ),
            new EmptyStatement()
        ),
        "for (var foo in [1, 2, 3, 4]);"
    );
  }
View Full Code Here

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

    assertParserOutput(
        new ForStatement(
            null,
            null,
            null,
            new EmptyStatement()
        ),
        "for (;;);"
    );
    assertParserOutput(
        new ForStatement(
            null,
            null,
            new IncrementExpression(
                new Identifier("x"),
                +1,
                true
            ),
            new EmptyStatement()
        ),
        "for (;; x++);"
    );
    assertParserOutput(
        new ForStatement(
            null,
            new BinaryOperatorExpression(
                new Identifier("x"),
                new NumberLiteral(4.0),
                Token.OPERATOR_LESSTHAN
            ),
            null,
            new EmptyStatement()
        ),
        "for (; x < 4;);"
    );
    assertParserOutput(
        new ForStatement(
            null,
            new BinaryOperatorExpression(
                new Identifier("x"),
                new NumberLiteral(4.0),
                Token.OPERATOR_LESSTHAN
            ),
            new IncrementExpression(
                new Identifier("x"), +1, true
            ),
            new EmptyStatement()
        ),
        "for (; x < 4; x++);"
    );
    assertParserOutput(
        new ForStatement(
            new AssignmentExpression(
                new Identifier("x"),
                new NumberLiteral(0.0)
            ),
            new BinaryOperatorExpression(
                new Identifier("x"),
                new NumberLiteral(4.0),
                Token.OPERATOR_LESSTHAN
            ),
            new IncrementExpression(
                new Identifier("x"), +1, true
            ),
            new EmptyStatement()
        ),
        "for (x = 0; x < 4; x++);"
    );
    assertParserOutput(
        new ForStatement(
            new VariableExpression(
                new VariableDeclaration[] {
                    new VariableDeclaration(
                        new Identifier("x"),
                        new NumberLiteral(0.0)
                    ),
                }
            ),
            new BinaryOperatorExpression(
                new Identifier("x"),
                new NumberLiteral(4.0),
                Token.OPERATOR_LESSTHAN
            ),
            new IncrementExpression(
                new Identifier("x"), +1, true
            ),
            new EmptyStatement()
        ),
        "for (var x = 0; x < 4; x++);"
    );
    assertParserOutput(
        new ForStatement(
            new VariableExpression(
                new VariableDeclaration[] {
                    new VariableDeclaration(
                        new Identifier("x"),
                        new NumberLiteral(0.0)
                    ),
                    new VariableDeclaration(
                        new Identifier("y"),
                        new NumberLiteral(8.0)
                    )
                }
            ),
            new BinaryOperatorExpression(
                new Identifier("x"),
                new NumberLiteral(4.0),
                Token.OPERATOR_LESSTHAN
            ),
            new BinaryOperatorExpression(
                new IncrementExpression(
                    new Identifier("x"), +1, true
                ),
                new IncrementExpression(
                    new Identifier("y"), -1, true
                ),
                Token.OPERATOR_COMMA
            ),
            new EmptyStatement()
        ),
        "for (var x = 0, y = 8; x < 4; x++, y--);"
    );
  }
View Full Code Here

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

  public void testLabelledStatement() throws CompilerException {
    assertParserOutput(
        new LabelledStatement(
            new Identifier("foo"),
            new EmptyStatement()
        ),
        "foo: ;"
    );
    assertParserOutput(
        new LabelledStatement(
            new Identifier("foo"),
            new LabelledStatement(
                new Identifier("bar"),
                new EmptyStatement()
            )
        ),
        "foo: bar: ;"
    );
    assertParserOutput(
View Full Code Here

Examples of dtool.ast.statements.EmptyStatement

 
  public static final ParseRuleDescription RULE_FN_BODY = new ParseRuleDescription("FnBody", "FunctionBody");
 
  protected NodeResult<? extends IFunctionBody> parseFunctionBody() {
    if(tryConsume(DeeTokens.SEMICOLON)) {
      return resultConclude(false, srOf(lastLexElement(), new EmptyStatement()));
    }
    NodeResult<BlockStatement> blockResult = thisParser().parseBlockStatement(false, false);
    if(blockResult.node != null)
      return blockResult;
   
View Full Code Here

Examples of dtool.ast.statements.EmptyStatement

  }
  protected NodeResult<? extends IStatement> parseStatement(boolean parseCaseDefault, boolean isScoped) {
    switch (lookAhead()) {
    case SEMICOLON:
      consumeLookAhead();
      return resultConclude(false, srOf(lastLexElement(), new EmptyStatement()));
   
    case OPEN_BRACE:return parseBlockStatement(true, true, isScoped);
   
    case KW_IF: return parseStatement_ifStart();
    case KW_WHILE: return parseStatementWhile();
View Full Code Here

Examples of lombok.ast.EmptyStatement

   
    return posify(block);
  }
 
  public Node createEmptyStatement() {
    return posify(new EmptyStatement());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.