docs: static Matcher optimize(Matcher matcher) {
      Matcher m = matcher;
      Matcher opt = optimizeSinglePass(m);
      for (int i = 0; !m.equals(opt) && i < MAX_ITERATIONS; ++i) {
        m = opt;
        opt = optimizeSinglePass(m);
      }
      return opt;
    }