private static int parseSpaces(int start, @NotNull String s, @NotNull StringBuilder result, boolean escapeSpacesInTheEnd) {
    char c = s.charAt(start);
    if (c != ' ') return -1;
    int i = start;
    int nSpaces = 0;
    while (i < s.length() && s.charAt(i) == ' ') {
      nSpaces++;
      i++;
    }
    if (i >= s.length() && escapeSpacesInTheEnd) {
      result.append(StringUtil.repeat(" ", nSpaces - 1)).append("\\s");
      return i;
    }
    int nextIdx = i >= s.length() ? -1 : parseBackSlash(s, i);
    if (nextIdx != -1 && nextIdx < s.length() && s.charAt(nextIdx) == 'n') {
      result.append(StringUtil.repeat(" ", nSpaces - 1)).append("\\s");
      return i;
    }
    result.append(StringUtil.repeatSymbol(' ', nSpaces));
    return i;
  }
private static int parseSpaces(int start, @NotNull String s, @NotNull StringBuilder result, boolean escapeSpacesInTheEnd)