Package com.google.minijoe.compiler.ast

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


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


  public void testShiftRightUnsignedExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new Identifier("bar"),
                Token.OPERATOR_SHIFTRIGHTUNSIGNEDASSIGNMENT
            )
        ),
        "foo >>>= bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new AssignmentOperatorExpression(
                    new Identifier("bar"),
                    new Identifier("baz"),
                    Token.OPERATOR_SHIFTRIGHTUNSIGNEDASSIGNMENT

                ),
                Token.OPERATOR_SHIFTRIGHTUNSIGNEDASSIGNMENT
            )
        ),
        "foo >>>= bar >>>= baz;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new BinaryOperatorExpression(
                    new Identifier("bar"),
                    new NumberLiteral(1.0),
                    Token.OPERATOR_PLUS
                ),
                Token.OPERATOR_SHIFTRIGHTUNSIGNEDASSIGNMENT
View Full Code Here

  public void testBitwiseAndAssignmentExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new Identifier("bar"),
                Token.OPERATOR_BITWISEANDASSIGNMENT
            )
        ),
        "foo &= bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new AssignmentOperatorExpression(
                    new Identifier("bar"),
                    new Identifier("baz"),
                    Token.OPERATOR_BITWISEANDASSIGNMENT
                ),
                Token.OPERATOR_BITWISEANDASSIGNMENT

            )
        ),
        "foo &= bar &= baz;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new BinaryOperatorExpression(
                    new Identifier("bar"),
                    new NumberLiteral(1.0),
                    Token.OPERATOR_PLUS
                ),
                Token.OPERATOR_BITWISEANDASSIGNMENT
View Full Code Here

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

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

  public void testDoStatement() throws CompilerException {
    assertParserOutput(
        new DoStatement(
            new ExpressionStatement(
                new Identifier("something")
            ),
            new BooleanLiteral(true)
        ),
        "do something; while (true);"
    );
    assertParserOutput(
        new DoStatement(
            new BlockStatement(
                new Statement[] {
                    new ExpressionStatement(
                        new Identifier("something")
                    )
                }
            ),
            new BooleanLiteral(true)
        ),
View Full Code Here

  public void testPostfixIncrementExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new IncrementExpression(
                new Identifier("foo"), +1, true
            )
        ),
        "foo++;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new IncrementExpression(
                new PropertyExpression(
                    new Identifier("foo"),
                    new StringLiteral("bar")
                ),
                1,
                true
            )
View Full Code Here

  public void testPostfixDecrementExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new IncrementExpression(
                new Identifier("foo"), -1, true
            )
        ),
        "foo--;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new IncrementExpression(
                new PropertyExpression(
                    new Identifier("foo"),
                    new StringLiteral("bar")
                ),
                -1,
                true
            )
View Full Code Here

  }

  public void testIdentifier() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new Identifier("hatstand")
        ),
        "hatstand;"
    );
  }
View Full Code Here

  public void testObjectLiteral() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentExpression(
                new Identifier("foo"),
                new ObjectLiteral(
                    new ObjectLiteralProperty[] {}
                )
            )
        ),
        "foo = {};"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentExpression(
                new Identifier("foo"),
                new ObjectLiteral(
                    new ObjectLiteralProperty[] {
                        new ObjectLiteralProperty(
                            new StringLiteral("name"),
                            new StringLiteral("wibble")
                        )
                    }
                )
            )
        ),
        "foo = {name: \"wibble\"};"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentExpression(
                new Identifier("foo"),
                new ObjectLiteral(
                    new ObjectLiteralProperty[] {
                        new ObjectLiteralProperty(
                            new StringLiteral("name"),
                            new StringLiteral("wibble")
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.