repl: handle comments properly
authorSakthipriyan Vairamani <thechargingvolcano@gmail.com>
Sat, 24 Oct 2015 07:46:08 +0000 (13:16 +0530)
committerJames M Snell <jasnell@gmail.com>
Thu, 29 Oct 2015 15:38:44 +0000 (08:38 -0700)
commit8a2c4aeeaa7b4b80d63598406a5c199b19fbd378
tree688a97ed68b998324dd52fba4f48a01c476449da
parent8d78d687d5c5eec3ea1f171f9e85664c0b0bc97f
repl: handle comments properly

As it is, the comments are not handled properly in REPL. So, if the
comments have `'` or `"`, then they are treated as incomplete string
literals and the error is thrown in REPL.

This patch refactors the existing logic and groups everything in a
class.

Fixes: https://github.com/nodejs/node/issues/3421
PR-URL: https://github.com/nodejs/node/pull/3515
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
lib/repl.js
test/parallel/test-repl.js