moving print_tokens into the actual coffee-script module, so we can use it separately from the command-line

This commit is contained in:
Jeremy Ashkenas
2010-02-15 18:09:01 -05:00
parent e7291f57ba
commit 9c3040b704
4 changed files with 23 additions and 18 deletions

View File

@@ -48,6 +48,19 @@
exports.tree = function tree(code) {
return parser.parse(lexer.tokenize(code));
};
// Pretty-print a token stream.
exports.print_tokens = function print_tokens(tokens) {
var __a, __b, __c, strings, token;
strings = (function() {
__a = []; __b = tokens;
for (__c = 0; __c < __b.length; __c++) {
token = __b[__c];
__a.push('[' + token[0] + ' ' + token[1].toString().replace(/\n/, '\\n') + ']');
}
return __a;
}).call(this);
return strings.join(' ');
};
//---------- Below this line is obsolete, for the Ruby compiler. ----------------
// The path to the CoffeeScript executable.
compiler = function compiler() {