mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
got the CoffeeScript-in-CoffeeScript REPL running, and boy is she fast
This commit is contained in:
@@ -26,8 +26,8 @@
|
||||
};
|
||||
exports.VERSION = '0.5.0';
|
||||
// Compile CoffeeScript to JavaScript, using the Coffee/Jison compiler.
|
||||
exports.compile = function compile(code) {
|
||||
return (parser.parse(lexer.tokenize(code))).compile();
|
||||
exports.compile = function compile(code, options) {
|
||||
return (parser.parse(lexer.tokenize(code))).compile(options);
|
||||
};
|
||||
// Just the tokens.
|
||||
exports.tokenize = function tokenize(code) {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
exports.run = function run() {
|
||||
parse_options();
|
||||
if (options.interactive) {
|
||||
launch_repl();
|
||||
return require('./repl');
|
||||
}
|
||||
if (!(sources.length)) {
|
||||
usage();
|
||||
|
||||
@@ -11,7 +11,10 @@
|
||||
};
|
||||
// The main REPL function. Called everytime a line of code is entered.
|
||||
readline = function readline(code) {
|
||||
return coffee.ruby_compile(code, run);
|
||||
return run(coffee.compile(code, {
|
||||
no_wrap: true,
|
||||
globals: true
|
||||
}));
|
||||
};
|
||||
// Attempt to evaluate the command. If there's an exception, print it.
|
||||
run = function run(js) {
|
||||
@@ -27,7 +30,7 @@
|
||||
return print(prompt);
|
||||
};
|
||||
// Start up the REPL.
|
||||
process.stdio.open();
|
||||
process.stdio.addListener('data', readline);
|
||||
process.stdio.open();
|
||||
print(prompt);
|
||||
})();
|
||||
Reference in New Issue
Block a user