repl: refine handling of illegal tokens
Checklist
-
a test and/or benchmark is included -
tests and code linting passes -
the commit message follows commit guidelines
Affected core subsystem(s)
Description of change
Illegal tokens are only recoverable in string literals, RegExp literals, and block comments. If not in one of these constructs, immediately return an error rather than giving the user false hope by giving them a chance to try to recover.