repl: Catch syntax errors better
authorisaacs <i@izs.me>
Wed, 28 Aug 2013 01:53:39 +0000 (18:53 -0700)
committerisaacs <i@izs.me>
Wed, 4 Sep 2013 18:13:41 +0000 (11:13 -0700)
commit4631c503e35cd3bb75a10424dd47a73c12ec468e
tree1404b6407d8abdda071bc2287f2620a4c3646bf2
parent7494c84fe6fa1127de5a9827119d9e389cbfb016
repl: Catch syntax errors better

Replace the growing list of 'isSyntaxError' whackamole conditions with a
smarter approach.  This creates a vm Script object *first*, which will
parse the code and raise a SyntaxError right away.

We still do need the test function, but only because strict mode syntax
errors are not recoverable, and should be raised right away.  Really, we
should probably *only* continue on "unexpected end of input" SyntaxErrors.

Also fixes a very difficult-to-test nit where the '...' indentation is
not properly cleared when you ^C out of a syntax error.

Closes #6093
lib/repl.js
test/simple/test-repl.js