Package com.google.minijoe.compiler.ast

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


    );
  }

  public void testUnaryMinsExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new UnaryOperatorExpression(
                new Identifier("foo"),
                Token.OPERATOR_MINUS

            )
        ),
        "-foo;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new UnaryOperatorExpression(
                new IncrementExpression(
                    new Identifier("foo"),
                    -1, true
                ), Token.OPERATOR_MINUS
            )
        ),
        "-foo--;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new IncrementExpression(
                new UnaryOperatorExpression(
                    new Identifier("foo"),
                    Token.OPERATOR_MINUS
                ), -1, false
View Full Code Here


    );
  }

  public void testBitwiseNotExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new UnaryOperatorExpression(
                new Identifier("foo"),
                Token.OPERATOR_BITWISENOT
            )
        ),
        "~foo;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new UnaryOperatorExpression(
                new UnaryOperatorExpression(
                    new Identifier("foo"),
                    Token.OPERATOR_BITWISENOT
                ),
View Full Code Here

    );
  }

  public void testLogicalNotExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new UnaryOperatorExpression(
                new Identifier("foo"),
                Token.OPERATOR_LOGICALNOT
            )
        ),
        "!foo;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new UnaryOperatorExpression(
                new UnaryOperatorExpression(
                    new Identifier("foo"),
                    Token.OPERATOR_LOGICALNOT
                ),
View Full Code Here

  public void testWithStatement() throws CompilerException {
    assertParserOutput(
        new WithStatement(
            new Identifier("foo"),
            new ExpressionStatement(
                new Identifier("something")
            )
        ),
        "with (foo) something;"
    );
    assertParserOutput(
        new WithStatement(
            new Identifier("foo"),
            new BlockStatement(
                new Statement[] {
                    new ExpressionStatement(
                        new Identifier("something")
                    )
                }
            )
        ),
View Full Code Here

    super(name);
  }

  public void testAssignmentExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentExpression(
                new Identifier("foo"),
                new Identifier("bar")
            )
        ),
        "foo = bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentExpression(
                new Identifier("foo"),
                new AssignmentExpression(
                    new Identifier("bar"),
                    new Identifier("baz")
                )
            )
        ),
        "foo = bar = baz;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentExpression(
                new Identifier("foo"),
                new BinaryOperatorExpression(
                    new Identifier("bar"),
                    new NumberLiteral(1.0),
View Full Code Here

    );
  }

  public void testMultiplyAssignmentExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new Identifier("bar"),
                Token.OPERATOR_MULTIPLYASSIGNMENT
            )
        ),
        "foo *= bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new AssignmentOperatorExpression(
                    new Identifier("bar"),
                    new Identifier("baz"),
                    Token.OPERATOR_MULTIPLYASSIGNMENT
                ),
                Token.OPERATOR_MULTIPLYASSIGNMENT
            )
        ),
        "foo *= bar *= baz;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new BinaryOperatorExpression(
                    new Identifier("bar"),
                    new NumberLiteral(1.0),
View Full Code Here

    );
  }

  public void testDivideAssignmentExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new Identifier("bar"),
                Token.OPERATOR_DIVIDEASSIGNMENT
            )
        ),
        "foo /= bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new AssignmentOperatorExpression(
                    new Identifier("bar"),
                    new Identifier("baz"),
                    Token.OPERATOR_DIVIDEASSIGNMENT
                ),
                Token.OPERATOR_DIVIDEASSIGNMENT
            )
        ),
        "foo /= bar /= baz;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new BinaryOperatorExpression(
                    new Identifier("bar"),
                    new NumberLiteral(1.0),
View Full Code Here

    );
  }

  public void testModuloAssignmentExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new Identifier("bar"),
                Token.OPERATOR_MODULOASSIGNMENT
            )
        ),
        "foo %= bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new AssignmentOperatorExpression(
                    new Identifier("bar"),
                    new Identifier("baz"),
                    Token.OPERATOR_MODULOASSIGNMENT
                ),
                Token.OPERATOR_MODULOASSIGNMENT
            )
        ),
        "foo %= bar %= baz;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new BinaryOperatorExpression(
                    new Identifier("bar"),
                    new NumberLiteral(1.0),
View Full Code Here

    );
  }

  public void testAdditionAssignmentExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new Identifier("bar"),
                Token.OPERATOR_PLUSASSIGNMENT
            )
        ),
        "foo += bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new AssignmentOperatorExpression(
                    new Identifier("bar"),
                    new Identifier("baz"),
                    Token.OPERATOR_PLUSASSIGNMENT
                ),
                Token.OPERATOR_PLUSASSIGNMENT
            )
        ),
        "foo += bar += baz;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new BinaryOperatorExpression(
                    new Identifier("bar"),
                    new NumberLiteral(1.0),
View Full Code Here

    );
  }

  public void testSubtractionAssignmentExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new Identifier("bar"),
                Token.OPERATOR_MINUSASSIGNMENT
            )
        ),
        "foo -= bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new AssignmentOperatorExpression(
                    new Identifier("bar"),
                    new Identifier("baz"),
                    Token.OPERATOR_MINUSASSIGNMENT
                ),
                Token.OPERATOR_MINUSASSIGNMENT
            )
        ),
        "foo -= bar -= baz;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new BinaryOperatorExpression(
                    new Identifier("bar"),
                    new NumberLiteral(1.0),
View Full Code Here

TOP

Related Classes of com.google.minijoe.compiler.ast.ExpressionStatement

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.