static __registerParser(parser, target) {
    const { name, pattern, parser: parserFn } = parser;
    if (typeof name !== 'string')
      throw new Error("Can't register parser; parser.name must be a string");
    if (!(pattern instanceof RegExp))
      throw new Error(`Can't register parser; parser.pattern must be a regular expression`);
    if (typeof parserFn !== 'function')
      throw new Error("Can't register parser; parser.parser must be a function");
    this.deleteExistingHook(target, 'parsers', name);

    // make sure to trigger the setter
    target.hooks = deepmerge(target.hooks, {
      parsers: {
        [name]: {
          pattern,
          parser: parserFn,
        },
      },
    });
    return target;
  }
@param {Parser} parser
@param {typeof Register | Register} target