code: function isRecoverableError(error) {
    if (error && error.name === "SyntaxError") {
      var message = error.message;
      if (
        message === "Unterminated template literal" ||
        message === "Missing } in template expression"
      ) {
        return true;
      }
  
      if (
        message.startsWith("Unexpected end of input") ||
        message.startsWith("missing ) after argument list") ||
        message.startsWith("Unexpected token")
      )
        return true;
    }
    return false;
  }
docs: see https://github.com/nodejs/node/blob/master/lib/repl.js#L1371