2009-12-16 22:42:53 -05:00
|
|
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
|
|
require "coffee_script/lexer"
|
|
|
|
require "coffee_script/parser"
|
|
|
|
require "coffee_script/nodes"
|
2009-12-17 10:04:43 -05:00
|
|
|
require "coffee_script/value"
|
|
|
|
require "coffee_script/scope"
|
2009-12-31 13:22:33 -05:00
|
|
|
require "coffee_script/rewriter"
|
2009-12-17 10:04:43 -05:00
|
|
|
require "coffee_script/parse_error"
|
2009-12-16 22:42:53 -05:00
|
|
|
|
|
|
|
# Namespace for all CoffeeScript internal classes.
|
|
|
|
module CoffeeScript
|
|
|
|
|
2010-01-27 08:01:18 -05:00
|
|
|
VERSION = '0.3.1' # Keep in sync with the gemspec.
|
2009-12-16 22:42:53 -05:00
|
|
|
|
2009-12-17 21:57:21 -05:00
|
|
|
# Compile a script (String or IO) to JavaScript.
|
2009-12-24 18:31:00 -05:00
|
|
|
def self.compile(script, options={})
|
2009-12-16 22:42:53 -05:00
|
|
|
script = script.read if script.respond_to?(:read)
|
2009-12-24 18:31:00 -05:00
|
|
|
Parser.new.parse(script).compile(options)
|
2009-12-16 22:42:53 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|