|
@ -267,18 +267,6 @@ function REPLServer(prompt, stream, eval_, useGlobal, ignoreUndefined) { |
|
|
finish(null); |
|
|
finish(null); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function isSyntaxError(e) { |
|
|
|
|
|
// Convert error to string
|
|
|
|
|
|
e = e && (e.stack || e.toString()); |
|
|
|
|
|
return e && e.match(/^SyntaxError/) && |
|
|
|
|
|
// RegExp syntax error
|
|
|
|
|
|
!e.match(/^SyntaxError: Invalid regular expression/) && |
|
|
|
|
|
!e.match(/^SyntaxError: Invalid flags supplied to RegExp constructor/) && |
|
|
|
|
|
// JSON.parse() error
|
|
|
|
|
|
!(e.match(/^SyntaxError: Unexpected (token .*|end of input)/) && |
|
|
|
|
|
e.match(/\n at Object.parse \(native\)\n/)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function finish(e, ret) { |
|
|
function finish(e, ret) { |
|
|
|
|
|
|
|
|
self.memory(cmd); |
|
|
self.memory(cmd); |
|
@ -918,3 +906,21 @@ REPLServer.prototype.convertToContext = function(cmd) { |
|
|
|
|
|
|
|
|
return cmd; |
|
|
return cmd; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Returns `true` if "e" is a SyntaxError, `false` otherwise. |
|
|
|
|
|
* This function filters out false positives likes JSON.parse() errors and |
|
|
|
|
|
* RegExp syntax errors. |
|
|
|
|
|
*/ |
|
|
|
|
|
function isSyntaxError(e) { |
|
|
|
|
|
// Convert error to string
|
|
|
|
|
|
e = e && (e.stack || e.toString()); |
|
|
|
|
|
return e && e.match(/^SyntaxError/) && |
|
|
|
|
|
// RegExp syntax error
|
|
|
|
|
|
!e.match(/^SyntaxError: Invalid regular expression/) && |
|
|
|
|
|
!e.match(/^SyntaxError: Invalid flags supplied to RegExp constructor/) && |
|
|
|
|
|
// JSON.parse() error
|
|
|
|
|
|
!(e.match(/^SyntaxError: Unexpected (token .*|end of input)/) && |
|
|
|
|
|
e.match(/\n at Object.parse \(native\)\n/)); |
|
|
|
|
|
} |
|
|