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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user