} catch ( JavaScriptException Signal ) { Context.reportError( "JavaScriptException while evaluating file \"" + fileName + "\" (reason: \"" + Signal.getMessage() + "\")" ); } catch ( IOException Signal ) { Context.reportError( "Error while reading file \""
} catch (JavaScriptException jse) { System.err.println("js: " + jse.getMessage()); } catch (IOException ioe) { System.err.println(ioe.toString()); System.err.println("js: " + ee.getMessage()); } catch (JavaScriptException jse) { System.err.println("js: " + jse.getMessage()); } catch (IOException ioe) { System.err.println(ioe.toString());
public String compile(String coffeeScriptSource) { Context context = Context.enter(); try { Scriptable compileScope = context.newObject(globalScope); compileScope.setParentScope(globalScope); compileScope.put("coffeeScript", compileScope, coffeeScriptSource); try { String options = bare ? "{bare: true}" : "{}"; return (String) context.evaluateString( compileScope, String.format("CoffeeScript.compile(coffeeScript, %s);", options), "source", 0, null); } catch (JavaScriptException e) { throw new CoffeeScriptException(e.getMessage()); } } finally { Context.exit(); } }
private String doCompile(final String coffeeScriptSource) { Context context = createContext(); try { Scriptable compileScope = context.newObject(coffeeScript); compileScope.setParentScope(coffeeScript); compileScope.put("coffeeScript", compileScope, coffeeScriptSource); try { String options = bare ? "{bare: true}" : "{}"; return (String) context.evaluateString( compileScope, String.format("compile(coffeeScript, %s);", options), "source", 0, null); } catch (JavaScriptException e) { throw new CoffeeScriptException(e.getMessage(), e); } } finally { Context.exit(); } }
public String compile(String coffeeScriptSource, String name) throws CoffeeException, IOException { if (globalScope == null) { init(); } long start = System.currentTimeMillis(); options = new Options(optionArgs); Context context = Context.enter(); try { Scriptable compileScope = context.newObject(globalScope); compileScope.setParentScope(globalScope); compileScope.put("coffeeScriptSource", compileScope, coffeeScriptSource); try { String result = (String) context.evaluateString(compileScope, String.format("CoffeeScript.compile(coffeeScriptSource, %s);", options.toJavaScript()), name, 0, null); if (logger.isDebugEnabled()) { logger.debug("Finished compilation of Coffee source in %,d ms.", System.currentTimeMillis() - start); } return result; } catch (JavaScriptException e) { throw new CoffeeException(e.getMessage()); } } finally { Context.exit(); } }