Package httl.ast

Examples of httl.ast.BinaryOperator


  }

  private BinaryOperator createBinaryOperator(String operator, int priority, int offset) {
    String name = BINARY_OPERATOR_NAMES.get(operator);
    if (StringUtils.isNotEmpty(name)) {
      return new BinaryOperator(name, priority, offset);
    } else if (StringUtils.isFunction(operator)) {
      return new BinaryOperator(operator.substring(1), priority, offset);
    } else {
      throw new UnsupportedOperationException("Unsupported binary operator " + operator);
    }
  }
View Full Code Here


          operatorStack.push(operator);
        } else {
          if (! StringUtils.isFunction(msg) && ! BINARY_OPERATORS.contains(msg)) {
            throw new ParseException("Unsupported binary operator " + msg, getTokenOffset(token) );
          }
          BinaryOperator operator = createBinaryOperator(msg, getPriority(msg, false), getTokenOffset(token));
          operatorTokens.put(operator, token);
          while (! operatorStack.isEmpty() && ! (operatorStack.peek() instanceof Bracket)
              && operatorStack.peek().getPriority() >= operator.getPriority()) {
            popOperator(parameterStack, operatorStack, operatorTokens, offset);
          }
          operatorStack.push(operator);
        }
        if ("[".equals(msg)) {
View Full Code Here

    if (operatorStack.isEmpty())
      throw new ParseException("Miss left parenthesis", offset);
    Operator operator = operatorStack.pop(); // 将优先级高于及等于当前操作符的弹出
    if (operator instanceof BinaryOperator) {
      Token token = operatorTokens.get(operator);
      BinaryOperator binaryOperator = (BinaryOperator) operator;
      if (parameterStack.isEmpty())
        throw new ParseException("Binary operator " + binaryOperator.getName() + " miss parameter", token == null ? offset : getTokenOffset(token));
      binaryOperator.setRightParameter(parameterStack.pop()); // right first
      if (parameterStack.isEmpty())
        throw new ParseException("Binary operator " + binaryOperator.getName() + " miss parameter", token == null ? offset : getTokenOffset(token));
      binaryOperator.setLeftParameter(parameterStack.pop());
      parameterStack.push(operator);
    } else if (operator instanceof UnaryOperator) {
      Token token = operatorTokens.get(operator);
      UnaryOperator unaryOperator = (UnaryOperator) operator;
      if (parameterStack.isEmpty())
View Full Code Here

TOP

Related Classes of httl.ast.BinaryOperator

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.