multiline strings

This commit is contained in:
Jeremy Ashkenas
2009-12-17 08:23:07 -05:00
parent c6f11fbfeb
commit d1682f5b3f
3 changed files with 17 additions and 3 deletions

View File

@@ -30,6 +30,7 @@ Usage:
def compile_javascript
@sources.each do |source|
next tokens(source) if @options[:tokens]
contents = CoffeeScript.compile(File.open(source))
next puts(contents) if @options[:print]
next lint(contents) if @options[:lint]
@@ -55,6 +56,10 @@ Usage:
stdout.close and stderr.close
end
def tokens(source)
puts Lexer.new.tokenize(File.read(source)).inspect
end
# Write out JavaScript alongside CoffeeScript unless an output directory
# is specified.
def path_for(source)
@@ -76,6 +81,9 @@ Usage:
opts.on('-l', '--lint', 'pipe the compiled javascript through JSLint') do |l|
@options[:lint] = true
end
opts.on('-t', '--tokens', 'print the tokens that the lexer produces') do |t|
@options[:tokens] = true
end
opts.on_tail('-v', '--version', 'display coffee-script version') do
puts "coffee-script version #{CoffeeScript::VERSION}"
exit