Package com.google.minijoe.compiler.ast

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


    );
  }

  public void testBitwiseOrExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new BinaryOperatorExpression(
                new Identifier("foo"),
                new Identifier("bar"),
                Token.OPERATOR_BITWISEOR
            )
        ),
        "foo | bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new BinaryOperatorExpression(
                new BinaryOperatorExpression(
                    new Identifier("foo"),
                    new Identifier("bar"),
                    Token.OPERATOR_BITWISEOR
                ),
                new Identifier("baz"),
                Token.OPERATOR_BITWISEOR
            )
        ),
        "foo | bar | baz;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new BinaryOperatorExpression(
                new Identifier("foo"),
                new BinaryOperatorExpression(
                    new Identifier("bar"),
                    new NumberLiteral(1.0),
View Full Code Here


    );
  }

  public void testBitwiseXorExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new BinaryOperatorExpression(
                new Identifier("foo"),
                new Identifier("bar"),
                Token.OPERATOR_BITWISEXOR
            )
        ),
        "foo ^ bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new BinaryOperatorExpression(
                new BinaryOperatorExpression(
                    new Identifier("foo"),
                    new Identifier("bar"),
                    Token.OPERATOR_BITWISEXOR
                ),
                new Identifier("baz"),
                Token.OPERATOR_BITWISEXOR
            )
        ),
        "foo ^ bar ^ baz;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new BinaryOperatorExpression(
                new Identifier("foo"),
                new BinaryOperatorExpression(
                    new Identifier("bar"),
                    new NumberLiteral(1.0),
View Full Code Here

    super(name);
  }

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

    );
  }

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

    super(name);
  }

  public void testDeleteExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new DeleteExpression(
                new Identifier("foo")
            )
        ),
        "delete foo;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new UnaryOperatorExpression(
                new DeleteExpression(
                    new Identifier("foo")
                ),
                Token.KEYWORD_VOID
View Full Code Here

    );
  }

  public void testTypeOfExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new UnaryOperatorExpression(
                new Identifier("foo"),
                Token.KEYWORD_TYPEOF
            )
        ),
        "typeof foo;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new UnaryOperatorExpression(
                new UnaryOperatorExpression(
                    new Identifier("foo"),
                    Token.KEYWORD_TYPEOF
                ),
View Full Code Here

    );
  }

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

    );
  }

  public void testPrefixIncrementExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new IncrementExpression(
                new Identifier("foo"), 1, false
            )
        ),
        "++foo;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new IncrementExpression(
                new IncrementExpression(
                    new Identifier("foo"), 1, true
                ),
                1, false
            )
        ),
        "++foo++;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new IncrementExpression(
                new IncrementExpression(
                    new Identifier("foo"), 1, false
                ), 1, false
            )
View Full Code Here

    );
  }

  public void testPrefixDecrementExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new IncrementExpression(
                new Identifier("foo"), -1, false
            )
        ),
        "--foo;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new IncrementExpression(
                new IncrementExpression(
                    new Identifier("foo"), -1, true
                ), -1, false
            )
        ),
        "--foo--;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new IncrementExpression(
                new IncrementExpression(
                    new Identifier("foo"), -1, false
                ), -1, false
            )
View Full Code Here

    );
  }

  public void testUnaryPlusExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new UnaryOperatorExpression(
                new Identifier("foo"),
                Token.OPERATOR_PLUS
            )
        ),
        "+foo;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new UnaryOperatorExpression(
                new IncrementExpression(
                    new Identifier("foo"), 1, true
                ),
                Token.OPERATOR_PLUS
            )
        ),
        "+foo++;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new IncrementExpression(
                new UnaryOperatorExpression(
                    new Identifier("foo"),
                    Token.OPERATOR_PLUS
                ), 1, false
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.