mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-19 03:44:23 -05:00
got the CoffeeScript-in-CoffeeScript REPL running, and boy is she fast
This commit is contained in:
@@ -20,8 +20,8 @@ parser.lexer: {
|
||||
exports.VERSION: '0.5.0'
|
||||
|
||||
# Compile CoffeeScript to JavaScript, using the Coffee/Jison compiler.
|
||||
exports.compile: (code) ->
|
||||
(parser.parse lexer.tokenize code).compile()
|
||||
exports.compile: (code, options) ->
|
||||
(parser.parse lexer.tokenize code).compile(options)
|
||||
|
||||
# Just the tokens.
|
||||
exports.tokenize: (code) ->
|
||||
|
||||
@@ -35,7 +35,7 @@ option_parser: null
|
||||
# The CommandLine handles all of the functionality of the `coffee` utility.
|
||||
exports.run: ->
|
||||
parse_options()
|
||||
launch_repl() if options.interactive
|
||||
return require './repl' if options.interactive
|
||||
usage() unless sources.length
|
||||
compile_scripts()
|
||||
this
|
||||
|
||||
@@ -9,7 +9,7 @@ prompt: 'coffee> '
|
||||
quit: -> process.stdio.close()
|
||||
|
||||
# The main REPL function. Called everytime a line of code is entered.
|
||||
readline: (code) -> coffee.ruby_compile code, run
|
||||
readline: (code) -> run coffee.compile code, {no_wrap: true, globals: true}
|
||||
|
||||
# Attempt to evaluate the command. If there's an exception, print it.
|
||||
run: (js) ->
|
||||
@@ -21,6 +21,6 @@ run: (js) ->
|
||||
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