Package org.mozilla.javascript

Examples of org.mozilla.javascript.Context.evaluateString()


          "file:///ttlString",
          1,
          (Object)null);

      result =
        cx.evaluateString(
          scope,
          testString.replaceAll("org", "xorg"),
          "file:///testString",
          1,
          (Object)null);
View Full Code Here


      // now evaluate the condition using JavaScript
      Context cx = Context.enter();
      try {
          Scriptable scope = cx.initStandardObjects(null);
          Object cxResultObject =
            cx.evaluateString(scope, cond
          /*** conditionString ***/
          , "<cmd>", 1, null);
          resultStr = Context.toString(cxResultObject);

          if (resultStr.equals("false")) {
View Full Code Here

    compileScope.put("source", compileScope, source);
    compileScope.put("templateKey", compileScope, templateKey);

    try {
      return (String) context.evaluateString(compileScope, compileScript, compileSourceName, 0, null);
    } catch (JavaScriptException e) {
      throw new RuntimeException("thrown error when compile Dust JS Source", e);
    }
  }
View Full Code Here

    compileScope.setParentScope(globalScope);

    compileScope.put("compiledSource", compileScope, compiledSource);

    try {
      context.evaluateString(compileScope, loadScript, compileSourceName, 0, null);
    } catch (JavaScriptException e) {
      throw new RuntimeException("thrown error when load Dust JS Source", e);
    }
  }
View Full Code Here

    try {
      renderScope.put("writer", renderScope, writer);
      renderScope.put("json", renderScope, json);
      renderScope.put("templateKey", renderScope, templateKey);

      context.evaluateString(renderScope, renderScript, compileSourceName, 0, null);

    } catch (JavaScriptException e) {
      throw new RuntimeException("thrown error when Rendering Dust JS Source", e);
    }
  }
View Full Code Here

      Scriptable compileScope = context.newObject(globalScope);
      compileScope.setParentScope(globalScope);
      compileScope.put("coffeeScriptSource", compileScope, coffeeScriptSource);
      try {

        return (String) context.evaluateString(compileScope, String.format("CoffeeScript.compile(coffeeScriptSource, %s);", options.toJavaScript()),
            name, 0, null);
      } catch (JavaScriptException e) {
        throw new CoffeeException(e);
      }
    } finally {
View Full Code Here

            cx.setGeneratingDebug(false);
            cx.setGeneratingSource(false);
            cx.setOptimizationLevel(0);
            cx.setDebugger(null, null);

            retval = cx.evaluateString(global, scriptText,
                                       source, lineNo,
                                       null);

            if (retval instanceof NativeJavaObject)
                retval = ((NativeJavaObject) retval).unwrap();
View Full Code Here

      Scriptable compileScope = context.newObject(globalScope);
      compileScope.setParentScope(globalScope);
      compileScope.put("coffeeScriptSource", compileScope, coffeeScriptSource);
      try {

        return (String) context.evaluateString(compileScope, String.format("CoffeeScript.compile(coffeeScriptSource, %s);", options.toJavaScript()),
            name, 0, null);
      } catch (JavaScriptException e) {
        throw new CoffeeException(e);
      }
    } finally {
View Full Code Here

            cx.setGeneratingDebug(false);
            cx.setGeneratingSource(false);
            cx.setOptimizationLevel(0);
            cx.setDebugger(null, null);

            retval = cx.evaluateString(global, scriptText,
                                       source, lineNo,
                                       null);

            if (retval instanceof NativeJavaObject)
                retval = ((NativeJavaObject) retval).unwrap();
View Full Code Here

      Object wrappedThis = Context.javaToJS( this, scope );
      ScriptableObject.putProperty( scope, "out", wrappedOut ); //$NON-NLS-1$
      ScriptableObject.putProperty( scope, "rule", wrappedThis ); //$NON-NLS-1$

      // evaluate the script
      Object resultObject = cx.evaluateString( scope, script, "<cmd>", 1, null ); //$NON-NLS-1$

      Object actualObject = null;
      if ( resultObject instanceof org.mozilla.javascript.NativeJavaObject ) {
        actualObject = ( (org.mozilla.javascript.NativeJavaObject) resultObject ).unwrap();
      } else {
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.