private static int skipSpaces(int pos, int max, @NotNull String str, boolean allowSpaces) {
    while (allowSpaces && pos < max && Character.isWhitespace(str.charAt(pos))) ++pos;
    return pos;
  }
private static int skipSpaces(int pos, int max, @NotNull String str, boolean allowSpaces)