Package com.google.minijoe.compiler.ast

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


      declarationVector.addElement(parseVariableDeclaration(true));
    }

    readTokenSemicolon();

    return new VariableStatement(Util.vectorToDeclarationArray(declarationVector));
  }
View Full Code Here


    super(name);
  }

  public void testVariableStatement() throws CompilerException {
    assertParserOutput(
        new VariableStatement(
            new VariableDeclaration[] {
                new VariableDeclaration(
                    new Identifier("foo"),
                    null
                )
            }
        ),
        "var foo;"
    );
    assertParserOutput(
        new VariableStatement(
            new VariableDeclaration[] {
                new VariableDeclaration(
                    new Identifier("foo"),
                    new NumberLiteral(1.0)
                )
            }
        ),
        "var foo = 1.0;"
    );
    assertParserOutput(
        new VariableStatement(
            new VariableDeclaration[] {
                new VariableDeclaration(
                    new Identifier("bar"),
                    new BinaryOperatorExpression(
                        new Identifier("x"),
                        new Identifier("baz"),
                        Token.KEYWORD_IN
                    )
                )
            }
        ),
        "var bar = x in baz;"
    );
    assertParserOutput(
        new VariableStatement(
            new VariableDeclaration[] {
                new VariableDeclaration(
                    new Identifier("foo"),
                    null
                ),
                new VariableDeclaration(
                    new Identifier("bar"),
                    null
                )
            }
        ),
        "var foo, bar;"
    );
    assertParserOutput(
        new VariableStatement(
            new VariableDeclaration[] {
                new VariableDeclaration(
                    new Identifier("foo"),
                    new NumberLiteral(1.0)
                ),
                new VariableDeclaration(
                    new Identifier("bar"),
                    null
                )
            }
        ),
        "var foo = 1.0, bar;"
    );
    assertParserOutput(
        new VariableStatement(
            new VariableDeclaration[] {
                new VariableDeclaration(
                    new Identifier("foo"),
                    new NumberLiteral(1.0)
                ),
View Full Code Here

        "{ 1 \n 2 } 3 "
    );
    assertParserOutput(
        new Program(
            new Statement[] {
                new VariableStatement(
                    new VariableDeclaration[] {
                        new VariableDeclaration(
                            new Identifier("foo"),
                            null
                        )
View Full Code Here

                    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

TOP

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

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.