diff --git a/lib/coffee-script/repl.js b/lib/coffee-script/repl.js index d926cebd..6aa96121 100644 --- a/lib/coffee-script/repl.js +++ b/lib/coffee-script/repl.js @@ -22,6 +22,7 @@ var Assign, Block, Literal, Value, ast, err, js, ref1, referencedVars, token, tokens; input = input.replace(/\uFF00/g, '\n'); input = input.replace(/^\(([\s\S]*)\n\)$/m, '$1'); + input = input.replace(/^\s*try\s*{([\s\S]*)}\s*catch.*$/m, '$1'); ref1 = require('./nodes'), Block = ref1.Block, Assign = ref1.Assign, Value = ref1.Value, Literal = ref1.Literal; try { tokens = CoffeeScript.tokens(input); diff --git a/src/repl.coffee b/src/repl.coffee index ba508e3f..03d95b52 100644 --- a/src/repl.coffee +++ b/src/repl.coffee @@ -15,6 +15,9 @@ replDefaults = # Node's REPL sends the input ending with a newline and then wrapped in # parens. Unwrap all that. input = input.replace /^\(([\s\S]*)\n\)$/m, '$1' + # Node's REPL v6.9.1+ sends the input wrapped in a try/catch statement. + # Unwrap that too. + input = input.replace /^\s*try\s*{([\s\S]*)}\s*catch.*$/m, '$1' # Require AST nodes to do some AST manipulation. {Block, Assign, Value, Literal} = require './nodes'