Package com.google.minijoe.compiler.ast

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


  public void testCallExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new CallExpression(
                new Identifier("thing"),
                new Expression[] {
                }
            )
        ),
        "thing();"
    );
    assertParserOutput(
        new ExpressionStatement(
            new CallExpression(
                new Identifier("thing"),
                new Expression[] {
                  new NumberLiteral(1.0)
                }
            )
        ),
        "thing(1.0);"
    );
    assertParserOutput(
        new ExpressionStatement(
            new CallExpression(
                new Identifier("thing"),
                new Expression[] {
                  new NumberLiteral(1.0),
                  new StringLiteral("hatstand")
                }
            )
View Full Code Here


        new ExpressionStatement(
            new PropertyExpression(
                new NewExpression(
                    new PropertyExpression(
                        new NewExpression(
                            new Identifier("foo"),
                            new Expression[] {
                              new Identifier("String"),
                              new NumberLiteral(2.0)
                            }
                        ),
                        new StringLiteral("bar")
                    ),
View Full Code Here

        "(function () {});"
    );
    assertParserOutput(
        new ExpressionStatement(
            new FunctionLiteral(
                new Identifier("foo"),
                new Identifier[] {
                },
                new Statement[] {
                }
            )
        ),
        "(function foo() {});"
    );
    assertParserOutput(
        new ExpressionStatement(
            new FunctionLiteral(
                new Identifier("foo"),
                new Identifier[] {
                  new Identifier("a"),
                },
                new Statement[] {
                }
            )
        ),
        "(function foo(a) {});"
    );
    assertParserOutput(
        new ExpressionStatement(
            new FunctionLiteral(
                new Identifier("foo"),
                new Identifier[] {
                  new Identifier("a"),
                  new Identifier("b"),
                  new Identifier("c"),
                },
                new Statement[] {
                }
            )
        ),
        "(function foo(a, b, c) {});"
    );
    assertParserOutput(
        new ExpressionStatement(
            new FunctionLiteral(
                new Identifier("foo"),
                new Identifier[] {
                    new Identifier("a"),
                    new Identifier("b"),
                    new Identifier("c"),
                },
                new Statement[] {
                    new VariableStatement(
                        new VariableDeclaration[] {
                            new VariableDeclaration(
                                new Identifier("bar"),
                                new NumberLiteral(0.0)
                            )
                        }
                    )
                }
View Full Code Here

  public void testLessThanExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new BinaryOperatorExpression(
                new Identifier("foo"),
                new Identifier("bar"),
                Token.OPERATOR_LESSTHAN
            )
        ),
        "foo < bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new BinaryOperatorExpression(
                new BinaryOperatorExpression(
                    new Identifier("foo"),
                    new Identifier("bar"),
                    Token.OPERATOR_LESSTHAN
                ),
                new Identifier("baz"),
                Token.OPERATOR_LESSTHAN
            )
        ),
        "foo < bar < baz;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new BinaryOperatorExpression(
                new Identifier("foo"),
                new BinaryOperatorExpression(
                    new Identifier("bar"),
                    new NumberLiteral(1.0),
                    Token.OPERATOR_PLUS
                ),
                Token.OPERATOR_LESSTHAN
            )
View Full Code Here

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

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

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

  public void testInstanceOfExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new BinaryOperatorExpression(
                new Identifier("foo"),
                new Identifier("Object"),
                Token.KEYWORD_INSTANCEOF
            )
        ),
        "foo instanceof Object;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new BinaryOperatorExpression(
                new BinaryOperatorExpression(
                    new Identifier("foo"),
                    new Identifier("bar"),
                    Token.KEYWORD_INSTANCEOF
                ),
                new Identifier("baz"),
                Token.KEYWORD_INSTANCEOF
            )
        ),
        "foo instanceof bar instanceof baz;"
    );
View Full Code Here

  public void testInExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new BinaryOperatorExpression(
                new Identifier("foo"),
                new Identifier("bar"),
                Token.KEYWORD_IN
            )
        ),
        "foo in bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new BinaryOperatorExpression(
                new BinaryOperatorExpression(
                    new Identifier("foo"),
                    new Identifier("bar"),
                    Token.KEYWORD_IN
                ),
                new Identifier("baz"),
                Token.KEYWORD_IN
            )
        ),
        "foo in bar in baz;"
    );
View Full Code Here

                    new NumberLiteral(1.0),
                    new NumberLiteral(0.0),
                    Token.OPERATOR_EQUALEQUAL
                ),
                new IncrementExpression(
                    new Identifier("foo"), 1, true
                ),
                new IncrementExpression(
                    new Identifier("bar"), 1, true
                )
            )
        ),
        "1 == 0 ? foo ++ : bar ++;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new ConditionalExpression(
                new Identifier("foo"),
                new ConditionalExpression(
                    new Identifier("a"),
                    new Identifier("b"),
                    new Identifier("c")
                ),
                new ConditionalExpression(
                    new Identifier("x"),
                    new Identifier("y"),
                    new Identifier("z")
                )
            )
        ),
        "foo ? a ? b : c : x ? y : z;"
    );
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.