nodejs / node-v0.x-archive

Moved to https://github.com/nodejs/node
34.44k stars 7.31k forks source link

Interpreter fails to detect end of multi-line commands #1194

Closed broofa closed 13 years ago

broofa commented 13 years ago
$ node

// (node auto-detects the end of this command and runs it, as expected)
> JSON.parse('{\
... }');
{}

// (node fails to detect the end of this command and gets "stuck", so use ".break" to return to '>' prompt
> JSON.parse('{\
... "hi": 1\
... '});
...
... .break
> 
ghost commented 13 years ago

You have syntax error there ('} should be }'). REPL detects end of statement by the fact that it does not throw syntax error. So everything works as expected.

broofa commented 13 years ago

dooh