mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
coffee-script: tokens
/nodes
can now take options as well
This commit is contained in:
parent
ebdd57a2fe
commit
c5f922c5db
2 changed files with 8 additions and 8 deletions
|
@ -27,11 +27,11 @@
|
|||
throw err;
|
||||
}
|
||||
});
|
||||
exports.tokens = function(code) {
|
||||
return lexer.tokenize(code);
|
||||
exports.tokens = function(code, options) {
|
||||
return lexer.tokenize(code, options);
|
||||
};
|
||||
exports.nodes = function(code) {
|
||||
return parser.parse(lexer.tokenize(code));
|
||||
exports.nodes = function(code, options) {
|
||||
return parser.parse(lexer.tokenize(code, options));
|
||||
};
|
||||
exports.run = function(code, options) {
|
||||
var root;
|
||||
|
|
|
@ -33,14 +33,14 @@ exports.compile = compile = (code, options) ->
|
|||
throw err
|
||||
|
||||
# Tokenize a string of CoffeeScript code, and return the array of tokens.
|
||||
exports.tokens = (code) ->
|
||||
lexer.tokenize code
|
||||
exports.tokens = (code, options) ->
|
||||
lexer.tokenize code, options
|
||||
|
||||
# Tokenize and parse a string of CoffeeScript code, and return the AST. You can
|
||||
# then compile it by calling `.compile()` on the root, or traverse it by using
|
||||
# `.traverse()` with a callback.
|
||||
exports.nodes = (code) ->
|
||||
parser.parse lexer.tokenize code
|
||||
exports.nodes = (code, options) ->
|
||||
parser.parse lexer.tokenize code, options
|
||||
|
||||
# Compile and execute a string of CoffeeScript (on the server), correctly
|
||||
# setting `__filename`, `__dirname`, and relative `require()`.
|
||||
|
|
Loading…
Add table
Reference in a new issue