use of org.mozilla.javascript.NodeTransformer in project pentaho-kettle by pentaho.
the class ScriptDialog method parseVariables.
// This could be useful for further improvements
public static ScriptNode parseVariables(Context cx, Scriptable scope, String source, String sourceName, int lineno, Object securityDomain) {
// Interpreter compiler = new Interpreter();
CompilerEnvirons evn = new CompilerEnvirons();
// evn.setLanguageVersion(Context.VERSION_1_5);
evn.setOptimizationLevel(-1);
evn.setGeneratingSource(true);
evn.setGenerateDebugInfo(true);
ErrorReporter errorReporter = new ToolErrorReporter(false);
Parser p = new Parser(evn, errorReporter);
// IOException
ScriptNode tree = p.parse(source, "", 0);
new NodeTransformer().transform(tree);
// Script result = (Script)compiler.compile(scope, evn, tree, p.getEncodedSource(),false, null);
return tree;
}
use of org.mozilla.javascript.NodeTransformer in project pentaho-kettle by pentaho.
the class ScriptValuesModDialog method parseVariables.
// This could be useful for further improvements
public static ScriptNode parseVariables(Context cx, Scriptable scope, String source, String sourceName, int lineno, Object securityDomain) {
// Interpreter compiler = new Interpreter();
CompilerEnvirons evn = new CompilerEnvirons();
// evn.setLanguageVersion(Context.VERSION_1_5);
evn.setOptimizationLevel(-1);
evn.setGeneratingSource(true);
evn.setGenerateDebugInfo(true);
ErrorReporter errorReporter = new ToolErrorReporter(false);
Parser p = new Parser(evn, errorReporter);
// IOException
ScriptNode tree = p.parse(source, "", 0);
new NodeTransformer().transform(tree);
// Script result = (Script)compiler.compile(scope, evn, tree, p.getEncodedSource(),false, null);
return tree;
}
Aggregations