Examples of ExpressionParser


Examples of AlgebraGUI.ExpressionParser

        pw.println("<b><font size=\"3\" face=\"Arial\">" + message + "</font></b>");
    }

    private void WriteExercises(PolynomialExpression p[], boolean printSolutions, PrintWriter pw, PolynomialConfig pc, ReportConfig rc) {
            int i;
            ExpressionParser ep = new ExpressionParser();
            StartTable(pw);
            pw.write("Test # " + pc.getRandom().getSeed());
            if (printSolutions) {
                WriteKeyInTitle(pw);
            }
            switch (rc.getReportMode()) {
                case ExpandedToSimplified:
                    WriteBreak(pw);
                    WriteMessage("Simplify these polynomials.", pw);
                    break;

                case SimplifiedToExpanded:
                    WriteBreak(pw);
                    WriteMessage("Expand these polynomials.", pw);
                    break;
            }

            WriteBreak(pw);
            for (i = 0; i < rc.getTotalProblems(); i++) {
                StartRow(pw);
                WriteIndexColumn(i + 1, pw);
                StartLeftColumn(pw);
                switch (rc.getReportMode()) {
                    case ExpandedToSimplified:
                        pw.write(ep.parseString(p[i].toString()));
                        break;

                    case SimplifiedToExpanded:
                        pw.write(ep.parseString(p[i].Simplify().toString()));
                        break;
                }
                StopColumn(pw);
                StartRightColumn(pw);
                if (printSolutions == true) {
                    switch (rc.getReportMode()) {
                        case ExpandedToSimplified:
                            pw.write(ep.parseString(p[i].Simplify().toString()));
                            break;

                        case SimplifiedToExpanded:
                            pw.write(ep.parseString(p[i].toString()));
                            break;
                    }
                } else {
                    pw.write("&nbsp");
                }
View Full Code Here

Examples of anvil.script.parser.ExpressionParser

    Location location = getLocation();
    Parent parameters;
  
    String params = tag.getValue("params");
    if (params != null) {
      ExpressionParser p = new ExpressionParser(parser, location, params);
      parameters = p.parseParameterList();
     
    } else {
      int size = 0;
      int n = tag.getLength();
      for (int i=0; i<n; i++) {
View Full Code Here

Examples of anvil.script.parser.ExpressionParser


  public static final Expression[] parseForeachExpression(String expression, Location location, TemplateParser parser)
  {
    if (expression != null) {
      ExpressionParser expressionParser = new ExpressionParser(parser, location, expression);
      return expressionParser.parseForeachExpression();
    } else {
      parser.error(location, "Expression attribute missing");
      return new Expression[0];   
    }
  }  
View Full Code Here

Examples of anvil.script.parser.ExpressionParser

 

  public static final Expression doParseExpression(int type, String expression, Location location, TemplateParser parser)
  {
    if (expression != null) {
      ExpressionParser expressionParser =
        new ExpressionParser(parser, location, expression);
      return expressionParser.parseExpression(type);
    } else {
      parser.error(location, "Expression attribute missing");
      return Expression.NULL;
    }
  }  
View Full Code Here

Examples of anvil.script.parser.ExpressionParser

          break;
           
        case Attribute.TYPE_EXPR:
          value = value.trim();
          if (value.length() > 0) {
            ExpressionParser p = new ExpressionParser(parser, parser.getLocation(), value);
            node = p.parseExpression(p.TYPE_VALUE).getChild();
          } else {
            node = ConstantNode.UNDEFINED;
          }
          break;
        }
View Full Code Here

Examples of anvil.script.parser.ExpressionParser

  public void parse(TemplateParser parser, Tag tag)
  {
    String expr = tag.getValue("value");
    if (expr != null) {
      ExpressionParser p = new ExpressionParser(parser, getLocation(), expr);
      ExpressionList list = p.parseExpressionList();
      int n = list.childs();
      _expressions = new Expression[n];
      for(int i=0; i<n; i++) {
        _expressions[i] = new Expression(list.getChild(i), getLocation());
      }
View Full Code Here

Examples of anvil.script.parser.ExpressionParser

  public ParameterListDeclaration parseParameters(TemplateParser parser, Tag tag)
  {
    ParameterListDeclaration parameters = new ParameterListDeclaration();
    String params = tag.getValue("params");
    if (params != null) {
      ExpressionParser p = new ExpressionParser(parser, parser.getLocation(), params);
      p.parseParameterListDeclaration(parameters);
   
    } else {
      parameters.open();
      int n = tag.getLength();
      for(int i=0; i<n; i++) {
View Full Code Here

Examples of anvil.script.parser.ExpressionParser

    String expr = tag.getValue("expr");
    if (expr == null) {
      expr = tag.getValue("do");
    }
    if (expr != null) {
      ExpressionParser p = new ExpressionParser(parser, getLocation(), expr);
      Object[] list = p.parseForExpressionList();
      _init = (Expression[]) list[0];
      _condition = (Expression) list[1];
      _action = (Expression[]) list[2];
    }
    _label = parseLabel(parser, tag);
View Full Code Here

Examples of anvil.script.parser.ExpressionParser

    Parent parameters;
    Location location = getLocation();
  
    String params = tag.getValue("params");
    if (params != null) {
      ExpressionParser p = new ExpressionParser(parser, parser.getLocation(), params);
      parameters = p.parseParameterList();
   
    } else {
      int size = 0;
      int n = tag.getLength();
      for (int i=0; i<n; i++) {
View Full Code Here

Examples of com.gentics.api.lib.expressionparser.ExpressionParser

   * @param resolvable Resolvable used to resolve properties (e.g. filename)
   * @return Result as string
   */
  private static String evaluateString(final String expressionString, final Resolvable resolvable) {
    String result = null;
    ExpressionParser expressionParser = ExpressionParser.getInstance();
    try {
      EvaluableExpression expression = (EvaluableExpression) expressionParser.parse(expressionString);
      ExpressionQueryRequest expressionQueryRequest = new ExpressionQueryRequest(
          new PropertyResolver(resolvable), new HashMap<Object, Object>(0));
      result = (String) expression.evaluate(expressionQueryRequest, ExpressionEvaluator.OBJECTTYPE_STRING);
    } catch (ExpressionParserException e) {
      LOGGER.error("Error while evaluating the expression (" + expressionString + ") with the base resolvable ("
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.