mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-17 02:51:25 -05:00
moving print_tokens into the actual coffee-script module, so we can use it separately from the command-line
This commit is contained in:
@@ -68,7 +68,7 @@ compile_scripts: ->
|
||||
return unless source: sources.shift()
|
||||
opts: options
|
||||
posix.cat(source).addCallback (code) ->
|
||||
if opts.tokens then puts tokenize(code)
|
||||
if opts.tokens then puts coffee.print_tokens coffee.tokenize code
|
||||
else if opts.tree then puts coffee.tree(code).toString()
|
||||
else
|
||||
js: coffee.compile code
|
||||
@@ -86,12 +86,6 @@ write_js: (source, js) ->
|
||||
posix.open(js_path, process.O_CREAT | process.O_WRONLY | process.O_TRUNC, parseInt('0755', 8)).addCallback (fd) ->
|
||||
posix.write(fd, js)
|
||||
|
||||
# Pretty-print the token stream.
|
||||
tokenize: (code) ->
|
||||
strings: coffee.tokenize(code).map (token) ->
|
||||
'[' + token[0] + ' ' + token[1].toString().replace(/\n/, '\\n') + ']'
|
||||
strings.join(' ')
|
||||
|
||||
# Pipe compiled JS through JSLint (requires a working 'jsl' command).
|
||||
lint: (js) ->
|
||||
jsl: process.createChildProcess('jsl', ['-nologo', '-stdin'])
|
||||
|
||||
Reference in New Issue
Block a user