Package httl.ast

Examples of httl.ast.Expression


                blank ++;
              }
              if (blank > 0) {
                expr = expr.substring(blank);
              }
              Expression expression = (Expression) expressionParser.parse(expr, exprOffset + i + 1 + blank + o);
              boolean export = false;
              boolean hide = false;
              if (var.endsWith(":")) {
                export = true;
                var = var.substring(0, var.length() - 1).trim();
              } else if (var.endsWith(".")) {
                hide = true;
                var = var.substring(0, var.length() - 1).trim();
              }
              int j = var.lastIndexOf(' ');
              String type = null;
              if (j > 0) {
                type = var.substring(0, j).trim();
                var = var.substring(j + 1).trim();
              }
              directives.add(new SetDirective(parseGenericType(type, exprOffset), var, expression, export, hide, offset));
              o += v.length() + 1;
            }
          } else {
            defineVariableTypes(value, offset, directives);
          }
        } else if (StringUtils.inArray(name, forDirective)) {
          if (StringUtils.isNumber(value.trim())) {
            value = "__for" + seq.incrementAndGet() + " : 1 .. " + value.trim();
          }
          int i = value.indexOf(" in ");
          int n = 4;
          if (i < 0) {
            i = value.indexOf(':');
            n = 1;
          }
          if (i < 0) {
            throw new ParseException("Miss colon \":\" in invalid directive #for(" + value + ")", offset);
          }
          String var = value.substring(0, i).trim();
          String expr = value.substring(i + n);
          int blank = 0;
          while (blank < expr.length()) {
            if (! Character.isWhitespace(expr.charAt(blank))) {
              break;
            }
            blank ++;
          }
          if (blank > 0) {
            expr = expr.substring(blank);
          }
          Expression expression = (Expression) expressionParser.parse(expr, exprOffset + i + n + blank);
          int j = var.lastIndexOf(' ');
          String type = null;
          if (j > 0) {
            type = var.substring(0, j).trim();
            var = var.substring(j + 1).trim();
View Full Code Here


      Operator operator = popOperator(parameterStack, operatorStack, operatorTokens, offset);
      if (operator == Bracket.ROUND || operator == Bracket.SQUARE) {
        throw new ParseException("Miss right parenthesis", offset);
      }
    }
    Expression result = parameterStack.pop();
    if (! parameterStack.isEmpty()) {
      Expression parent = parameterStack.pop();
      throw new ParseException("Miss parameter in the operator " + parent, parent.getOffset());
    }
    return result;
  }
View Full Code Here

TOP

Related Classes of httl.ast.Expression

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.