private static int skipSpacesBackward(int pos, int min, @NotNull String str, boolean allowSpaces) {
    while (allowSpaces && pos > min && Character.isWhitespace(str.charAt(pos - 1))) --pos;
    return pos;
  }
private static int skipSpacesBackward(int pos, int min, @NotNull String str, boolean allowSpaces)