Package net.sourceforge.processdash.data.compiler

Examples of net.sourceforge.processdash.data.compiler.CompiledScript


        else if (arguments.size() > 2)
            result = arguments.get(2);

        if (result instanceof CompiledScript) {
            try {
                CompiledScript script = (CompiledScript) result;
                ListStack stack = new ListStack();
                script.run(stack, context);
                result = stack.pop();
            } catch (Exception e) {}
        }

        return result;
View Full Code Here


        this.tag = tag;
    }

    public SearchFunction buildFor(String name, DataRepository data,
                                   String prefix) {
        CompiledScript script = null;
        if (expression != null) try {
            // normalize "unvarying" references - that is,
            // references marked with braces like [{this}]
            PValue expr = (PValue) expression.clone();
            expr.apply(new NormalizeReferences(data, prefix));
View Full Code Here

     *
     * This method <b>must</b> be thread-safe.
     */
    public Object call(List arguments, ExpressionContext context)
    {
        CompiledScript script = null;
        try {
            script = (CompiledScript) arguments.get(0);
        } catch (ClassCastException cce) { }
        if (script == null) return null;

        ListData result = new ListData();
        LocalExpressionContext lContext = new LocalExpressionContext(context);
        ListStack stack = new ListStack();
        Iterator i = collapseLists(arguments, 1).iterator();
        Object item;
        while (i.hasNext()) try {
            lContext.setLocalValue(item = i.next());
            stack.clear();
            script.run(stack, lContext);
            handleItem(result, item, stack.pop());
        } catch (Exception e) {}
        return result;
    }
View Full Code Here

      }

      /** Process a new style declaration. */
      public void caseANewStyleDeclaration(ANewStyleDeclaration node) {
        String name = Compiler.trimDelim(node.getIdentifier());
        CompiledScript script = null;
        try {
          script = Compiler.compile(node.getValue());
        } catch (CompilationException ce) {
          logger.severe("When parsing value for data element '" + name
                  + "', encountered error: " + ce.getMessage());
          putVal(name, new MalformedData(null));
          return;
        }
        if (!script.isConstant())
          putVal(name, script);
        else {
          SimpleData constant = script.getConstant();
          if (constant != null &&
              node.getAssignop() instanceof AReadOnlyAssignop)
            constant = (SimpleData) constant.getEditable(false);
          putVal(name, constant);
        }
View Full Code Here

        for (Iterator iter = arguments.iterator(); iter.hasNext();) {
            Object arg = iter.next();

            if (arg instanceof CompiledScript) {
                try {
                    CompiledScript script = (CompiledScript) arg;
                    if (stack == null)
                        stack = new ListStack();
                    else
                        stack.clear();
                    script.run(stack, context);
                    arg = stack.pop();
                } catch (Exception e) {}
            }

            if (arg instanceof SimpleData
View Full Code Here

        if (expression == null || expression.length() == 0)
            return null;

        String prefix = asString(getArg(arguments, 1));

        CompiledScript script = Compiler.compile(expression);

        try {
            Stack stack = new ListStack();
            if (prefix != null)
                context = new RelativeExpressionContext(context, prefix);
            script.run(stack, context);
            return stack.pop();
        } catch (ExecutionException ee) {
            return null;
        }
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.processdash.data.compiler.CompiledScript

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.