Package net.mitza.rel.parser.expression

Examples of net.mitza.rel.parser.expression.ExpressionNode


  // value -> NUMBER
  // value -> VARIABLE
  private ExpressionNode value() {
    // value -> NUMBER
    if (lookahead.tokenType == TokenTypes.VALUE) {
      ExpressionNode constant = new ConstantExpressionNode(lookahead.sequence);
      nextToken();
      return constant;
    }

    // value -> VARIABLE
    if (lookahead.tokenType == TokenTypes.VARIABLE) {
      ExpressionNode variable = variable();
      return variable;
    }

    if (lookahead.tokenType == TokenTypes.EPSILON) {
      throw new ParserException("Unexpected end of input");
View Full Code Here


    }

    // bean_op -> OPEN_BRACKET expression CLOSE_BRACKET bean_op
    if (lookahead.tokenType == TokenTypes.OPEN_BRACKET) {
      nextToken();
      ExpressionNode index = mathematicalExpression();
      bean.setIndex(index);
      if (lookahead.tokenType != TokenTypes.CLOSE_BRACKET) {
        throw new ParserException("Closing bracket expected", lookahead);
      }
      nextToken();
View Full Code Here

    // ExpressionNode expr = parser.parseExpression("sin(pi/2)");
    // expr.accept(new SetVariable("pi", Math.PI));
    // System.out.println("The value of the expression is " + expr.getValue());

    long t = System.currentTimeMillis();
    ExpressionNode expr = null;
    for (int i = 0; i < 1000; i++) {
      expr = parser.parseCondition("2.8 + 0.1*2 == 3 && 22 > 21 + 0.5");
      expr.getBooleanValue();
      expr = parser.parseExpression("a['b'] + ' o\\'clock' + (1 + 2 * 3 - sin(3) / 2 + 2 ^ 3)");
      expr.getValue();
      expr = parser.parseCondition("2.8 + 0.1*2 == 3 && 22 > 21 + 0.6");
      expr.getBooleanValue();
      expr = parser.parseExpression("a['b'] + ' o\\'clock' + (1 + 2 * 3 - sin(3) / 2 + 2 ^ 4)");
      expr.getValue();
    }

    t = System.currentTimeMillis() - t;
    log.debug("Finish. Execution took " + (t / 1000.0) + "s");

View Full Code Here

    if (expression == null) {
      return "";
    }

    Parser parser = new Parser(context);
    ExpressionNode expressionNode = parser.parseExpression(expression);
    return expressionNode.getValue();
  }
View Full Code Here

    if (condition == null) {
      return false;
    }

    Parser parser = new Parser(context);
    ExpressionNode expressionNode = parser.parseCondition(condition);
    return expressionNode.getBooleanValue();
  }
View Full Code Here

TOP

Related Classes of net.mitza.rel.parser.expression.ExpressionNode

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.