Package com.google.minijoe.compiler.ast

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


    if (nextToken == Token.OPERATOR_CONDITIONAL) {
      readToken(Token.OPERATOR_CONDITIONAL);
      Expression trueExpression = parseAssignmentExpression(inFlag);
      readToken(Token.OPERATOR_COLON);
      Expression falseExpression = parseAssignmentExpression(inFlag);
      return new ConditionalExpression(expression, trueExpression, falseExpression);
    } else {
      return expression;
    }
  }
View Full Code Here


  }

  public void testConditionalExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new ConditionalExpression(
                new BinaryOperatorExpression(
                    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")
                )
            )
View Full Code Here

TOP

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

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.