Package com.google.minijoe.compiler.ast

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


  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),
                    Token.OPERATOR_EQUALEQUAL
                )
            )
        ),
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),
                    Token.OPERATOR_EQUALEQUAL
                )
            )
        ),
View Full Code Here

  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
            )
        ),
        "void delete foo;"
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
                ),
                Token.KEYWORD_VOID
            )
        ),
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
                ),
                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
            )
        ),
        "++++foo;"
    );
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
            )
        ),
        "----foo;"
    );
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
            )
        ),
        "+++foo;"
View Full Code Here

  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
            )
        ),
        "---foo;"
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
                ),
                Token.OPERATOR_BITWISENOT
            )
        ),
View Full Code Here

TOP

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

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.