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 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
cc @mscdex @silverwind @ChuckLangFord @Fishrock123