Package com.google.minijoe.compiler.ast

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


    );
  }

  public void testThisExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new ThisLiteral()
        ),
        "this;"
    );
  }
View Full Code Here


    );
  }

  public void testNullLiteral() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new NullLiteral()
        ),
        "null;"
    );
  }
View Full Code Here

    );
  }

  public void testBooleanLiteral() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new BooleanLiteral(true)
        ),
        "true;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new BooleanLiteral(false)
        ),
        "false;"
    );
  }
View Full Code Here

    );
  }

  public void testNumericLiteral() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new NumberLiteral(Double.MIN_VALUE)
        ),
        Double.toString(Double.MIN_VALUE) + ";"
    );
    assertParserOutput(
        new ExpressionStatement(
            new NumberLiteral(0.1)
        ),
        "0.1;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new NumberLiteral(0.0)
        ),
        "0.0;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new NumberLiteral(1.0)
        ),
        "1.0;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new NumberLiteral(Integer.MAX_VALUE)
        ),
        Double.toString(Integer.MAX_VALUE) + ";"
    );
    assertParserOutput(
        new ExpressionStatement(
            new NumberLiteral(Float.MAX_VALUE)
        ),
        Double.toString(Float.MAX_VALUE) + ";"
    );
    assertParserOutput(
        new ExpressionStatement(
            new NumberLiteral(Double.MAX_VALUE)
        ),
        Double.toString(Double.MAX_VALUE) + ";"
    );
  }
View Full Code Here

    );
  }

  public void testStringLiteral() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new StringLiteral("foo")
        ),
        "\"foo\";"
    );
    assertParserOutput(
        new ExpressionStatement(
            new StringLiteral("bar")
        ),
        "\'bar\';"
    );
  }
View Full Code Here

    );
  }

  public void testArrayLiteral() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new ArrayLiteral(
                new Expression[] {
                }
            )
        ),
        "[];"
    );
    assertParserOutput(
        new ExpressionStatement(
            new ArrayLiteral(
                new Expression[] {
                    null
                }
            )
        ),
        "[,];"
    );
    assertParserOutput(
        new ExpressionStatement(
            new ArrayLiteral(
                new Expression[] {
                    new NumberLiteral(0.0)
                }
            )
        ),
        "[0.0];"
    );
    assertParserOutput(
        new ExpressionStatement(
            new ArrayLiteral(
                new Expression[] {
                    null,
                    new NumberLiteral(0.0)
                }
            )
        ),
        "[,0.0];"
    );
    assertParserOutput(
        new ExpressionStatement(
            new ArrayLiteral(
                new Expression[] {
                    new NumberLiteral(0.0)
                }
            )
        ),
        "[0.0,];"
    );
    assertParserOutput(
        new ExpressionStatement(
            new ArrayLiteral(
                new Expression[] {
                    new NumberLiteral(0.0),
                    null
                }
            )
        ),
        "[0.0,,];"
    );
    assertParserOutput(
        new ExpressionStatement(
            new ArrayLiteral(
                new Expression[] {
                    new NumberLiteral(0.0),
                    null,
                    new NumberLiteral(1.0)
                }
            )
        ),
        "[0.0,,1.0];"
    );
    assertParserOutput(
        new ExpressionStatement(
            new ArrayLiteral(
                new Expression[] {
                    new NumberLiteral(0.0),
                    null,
                    new NumberLiteral(1.0)
                }
            )
        ),
        "[0.0,,1.0,];"
    );
    assertParserOutput(
        new ExpressionStatement(
            new ArrayLiteral(
                new Expression[] {
                    new NumberLiteral(0.0),
                    null,
                    new NumberLiteral(1.0),
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(
View Full Code Here

    super(name);
  }

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

    );
  }

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

    );
  }

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

TOP

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

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.