org.plovr
Class CoffeeScriptCompiler

java.lang.Object
  extended by org.plovr.CoffeeScriptCompiler

public class CoffeeScriptCompiler
extends Object

Adapted from JCoffeeScriptCompiler.java in https://github.com/yeungda/jcoffeescript. This class would not need to exist if com.sun.script.javascript.RhinoScriptEngine behaved reasonably in Java 6: http://stackoverflow.com/questions/7000108/is-it-possible-to- set-the-optimization-level-for-rhinoscriptengine-in-java-6


Method Summary
 String compile(String coffeeScriptSource, String sourceName)
          Compiles the string of CoffeeScript code to JavaScript.
static CoffeeScriptCompiler getInstance()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static CoffeeScriptCompiler getInstance()
Returns:
the singleton instance of the CoffeeScriptCompiler

compile

public String compile(String coffeeScriptSource,
                      String sourceName)
               throws CoffeeScriptCompilerException
Compiles the string of CoffeeScript code to JavaScript. If the CoffeeScript compiler encounters an error, a CoffeeScriptCompilerException will be thrown. The name of the input is specified so it can be included in error messages.

Throws:
CoffeeScriptCompilerException