Examples of ExpressionParser


Examples of com.google.template.soy.exprparse.ExpressionParser

  /**
   * Private helper to check the rewrite of one expression.
   */
  private void assertRewrite(String origSrc, String expectedRewrittenSrc) throws Exception {

    ExprNode expr = (new ExpressionParser(origSrc)).parseExpression();
    (new RewriteNullCoalescingOpInExprVisitor()).exec(expr);
    String rewrittenSrc = expr.toSourceString();
    assertEquals(expectedRewrittenSrc, rewrittenSrc);
  }
View Full Code Here

Examples of com.googlecode.aviator.parser.ExpressionParser


    private static Expression innerCompile(final String expression) {
        ExpressionLexer lexer = new ExpressionLexer(expression);
        CodeGenerator codeGenerator = newCodeGenerator();
        ExpressionParser parser = new ExpressionParser(lexer, codeGenerator);
        return parser.parse();
    }
View Full Code Here

Examples of com.opengamma.financial.expression.deprecated.ExpressionParser

   * @param expression string expression
   * @deprecated Use the alternative constructor so that the parsing dialect is explicit
   */
  @Deprecated
  public ExpressionPortfolioFilter(final String expression) {
    this(new ExpressionParser().parse(expression));
  }
View Full Code Here

Examples of com.volantis.xml.expression.ExpressionParser

        if (expr == null) {
            forwardError(dynamicProcess,
                    "'expr' attribute must be specified on " + element);
        } else {
            ExpressionFactory factory = ExpressionFactory.getDefaultInstance();
            ExpressionParser parser = factory.createExpressionParser();
            try {
                // Parse, and evaluate the expression.
                Expression expression = parser.parse(expr);
                Value value = expression.evaluate(context);

                // Stream the value's contents into the process following the
                // dynamic process. Don't do it into the dynamic process as
                // that will cause any markup to get reevaluated.
View Full Code Here

Examples of com.volantis.xml.expression.ExpressionParser

        // initalize the parser that will be use to parse XPath expressions
        XMLPipelineFactory pipelineFactory =
                getPipelineContext().getPipelineFactory();
        ExpressionFactory expressionFactory =
                pipelineFactory.getExpressionFactory();
        ExpressionParser parser = expressionFactory.createExpressionParser();

        // create a process that can evaluate expressions
        ExpressionProcess expressionProcess = createExpressionProcess(parser);

        DISelectConditionalProcess diSelectProcess = new DISelectConditionalProcess(parser);
View Full Code Here

Examples of com.volantis.xml.expression.ExpressionParser

     * Tests the createParser() method
     * @throws Exception if an  error is encountered
     */
    public void testCreateParser() throws Exception {
        // ensure the correct object is created       
        ExpressionParser parser = factory.createExpressionParser();
        assertTrue("JXPathExpressionFactory createParser() should create " +
                   "JXPathExpressionParser instance",
                   (parser instanceof JXPathExpressionParser));
    }
View Full Code Here

Examples of com.volantis.xml.expression.ExpressionParser

    private Sequence evaluateExpression(
            final ExpressionContext expressionContext,
            String expressionAsString)
            throws ExtendedSAXException {
        ExpressionFactory factory = expressionContext.getFactory();
        ExpressionParser parser = factory.createExpressionParser();
        Sequence sequence;
        try {
            Expression expression = parser.parse(expressionAsString);
            Value value = expression.evaluate(expressionContext);
            sequence = value.getSequence();
        } catch (ExpressionException e) {
            throw new ExtendedSAXException(e);
        }
View Full Code Here

Examples of com.volantis.xml.expression.ExpressionParser

                "invalid-num-of-args",
                new Object[]{NAME, 1, arguments.length}));
        }

        ExpressionFactory expressionFactory = context.getFactory();
        ExpressionParser parser = expressionFactory.createExpressionParser();

        Expression expression = parser.parse(arguments[0].stringValue().asJavaString());
        return expression.evaluate(context);
    }
View Full Code Here

Examples of jmathexpr.util.parser.ExpressionParser

    public ParserTest() {
    }
   
    @Test
    public void testPolynomials() {
        ExpressionParser parser = new ExpressionParser();
       
        Expression expression = parser.parse("let x in R");
       
        Logger.dump(expression);
    }
View Full Code Here

Examples of jsynoptic.parser.ExpressionParser

                    JOptionPane.showMessageDialog(JSynoptic.gui.getOwner(),resources.getString("PleaseEnterAMathematicalExpression"),resources.getString("Error"),JOptionPane.ERROR_MESSAGE);
                    return;
                }
                ExpressionNode node = null;
                try {
                    ExpressionParser ep = new ExpressionParser(exp);
                    // Add the data sources as variables
                    // start by looping through collections
                    Set collections = DataSourcePool.global.dataSourceCollections();
                    for (Iterator it = collections.iterator(); it.hasNext(); ) {
                        Collection c = (Collection)it.next();
                        for (Iterator it2 = c.iterator(); it2.hasNext();) addVariable(ep, it2.next());
                    }
                    // also add sources
                    Set sources = DataSourcePool.global.dataSources();
                    for (Iterator it = sources.iterator(); it.hasNext();) addVariable(ep, it.next());
                    // Add known plugins => may bring in more mathematical functions
                    for (Iterator it = Run.plugins.iterator(); it.hasNext();) ep.addClass(it.next().getClass());
                    node = ep.parse();
                } catch (ParseException pe) {
                    // Also catches duplicate variable names
                    JOptionPane.showMessageDialog(JSynoptic.gui.getOwner(),pe.getLocalizedMessage(),resources.getString("InvalidExpression"),JOptionPane.ERROR_MESSAGE);
                    return;
                } catch (Error err) {
                    JOptionPane.showMessageDialog(JSynoptic.gui.getOwner(),err.getLocalizedMessage(),resources.getString("InvalidExpression"),JOptionPane.ERROR_MESSAGE);
                    return;
                }
                // Now we have a correct node, ready to evaluate()
                // Create a data source
                boolean newSource = true;
                // Check if the source exists, and in this case change the expression on the fly
                for (Iterator it = DataSourcePool.global.dataSources().iterator(); it.hasNext(); ) {
                    Object o = it.next();
                    if (!(o instanceof ExpressionDataSource)) continue;
                    ExpressionDataSource ds = (ExpressionDataSource)o;
                    if (name.equals(DataInfo.getLabel(ds)) || name.equals(DataInfo.getAlias(ds))) {
                        ds.changeExpression(exp, node);
                        newSource = false;
                        ExpressionPanel.this.sourceTree.setSelectedValue(ds);
                        TreeNode tn = (TreeNode)(ExpressionPanel.this.sourceTree.getSelectionPath().getLastPathComponent());
                        ((DefaultTreeModel)(ExpressionPanel.this.sourceTree.getModel())).nodeChanged(tn);
                        break;
                    }
                }
                if (newSource) {
                    ExpressionDataSource eds = new ExpressionDataSource(new DataInfo(name, name, exp), node);
                    DataSourcePool.global.addDataSource(eds);
                    ExpressionPanel.this.sourceTree.setSelectedValue(eds);
                }
            }

            private void addVariable(ExpressionParser ep, Object object) {
                if (object==null) return;
                if (!(object instanceof DataSource)) return;
                String alias = DataInfo.getAlias(object);
                if (alias!=null) ep.addVariable(new VariableAssociation((DataSource)object, alias));
                else ep.addVariable(new VariableAssociation((DataSource)object, DataInfo.getLabel(object)));
            }
        });

/*        delExp.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
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.