mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-17 19:11:22 -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:
@@ -1,5 +1,5 @@
|
||||
(function(){
|
||||
var BANNER, SWITCHES, WATCH_INTERVAL, coffee, compile, compile_scripts, lint, option_parser, options, optparse, parse_options, path, posix, sources, tokenize, usage, version, write_js;
|
||||
var BANNER, SWITCHES, WATCH_INTERVAL, coffee, compile, compile_scripts, lint, option_parser, options, optparse, parse_options, path, posix, sources, usage, version, write_js;
|
||||
posix = require('posix');
|
||||
path = require('path');
|
||||
coffee = require('coffee-script');
|
||||
@@ -69,7 +69,7 @@
|
||||
return posix.cat(source).addCallback(function(code) {
|
||||
var js;
|
||||
if (opts.tokens) {
|
||||
puts(tokenize(code));
|
||||
puts(coffee.print_tokens(coffee.tokenize(code)));
|
||||
} else if (opts.tree) {
|
||||
puts(coffee.tree(code).toString());
|
||||
} else {
|
||||
@@ -97,14 +97,6 @@
|
||||
return posix.write(fd, js);
|
||||
});
|
||||
};
|
||||
// Pretty-print the token stream.
|
||||
tokenize = function tokenize(code) {
|
||||
var strings;
|
||||
strings = coffee.tokenize(code).map(function(token) {
|
||||
return '[' + token[0] + ' ' + token[1].toString().replace(/\n/, '\\n') + ']';
|
||||
});
|
||||
return strings.join(' ');
|
||||
};
|
||||
// Pipe compiled JS through JSLint (requires a working 'jsl' command).
|
||||
lint = function lint(js) {
|
||||
var jsl;
|
||||
|
||||
Reference in New Issue
Block a user