@ApiStatus.Internal
  public static @Nullable TextWithMnemonic fromMnemonicText(@NotNull @Nls String text, boolean reportInvalidMnemonics) {
    int pos = text.indexOf(UIUtil.MNEMONIC);
    if (pos < 0) return null;
    String str = text.substring(pos + 1);

    Exception error = null;
    if (str.isEmpty()) error = new IllegalArgumentException("unexpected mnemonic marker in " + text);
    if (str.indexOf(UIUtil.MNEMONIC) >= 0) error = new IllegalArgumentException("several mnemonic markers in " + text);

    if (error != null) {
      if (reportInvalidMnemonics) {
        LOG.error(error);
      }
      else {
        LOG.warn(error);
      }
      return null;
    }

    return fromPlainTextWithIndex(pos > 0 ? text.substring(0, pos) + str : str, pos);
  }
@ApiStatus.Internal
  public static @Nullable TextWithMnemonic fromMnemonicText(@NotNull @Nls String text, boolean reportInvalidMnemonics)