Package com.google.minijoe.compiler.ast

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


            || nextToken == Token.OPERATOR_LOGICALNOT
            || nextToken == Token.KEYWORD_VOID
            || nextToken == Token.KEYWORD_TYPEOF) {
      Token token = nextToken;
      readToken();
      UnaryOperatorExpression result = new UnaryOperatorExpression(parseUnaryExpression(), token);
      return result;
    } else if (nextToken == Token.KEYWORD_DELETE) {
      readToken(Token.KEYWORD_DELETE);
      return new DeleteExpression(parseUnaryExpression());
    } else {
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

  }

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

        ),
        "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
                ),
                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

TOP

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

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.