mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
moving print_tokens (the pretty printer) from coffee_script to command_line
This commit is contained in:
parent
b26e577244
commit
2a46e13d33
13 changed files with 49 additions and 46 deletions
|
@ -45,17 +45,4 @@
|
|||
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 puts(strings.join(' '));
|
||||
};
|
||||
})();
|
||||
})();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue