private static int parseQuotes(int start, @NotNull String s, @NotNull StringBuilder result,
                                 boolean escapeStartQuote, boolean escapeEndQuote) {
    char c = s.charAt(start);
    if (c != '"') return -1;
    int nQuotes = 1;
    int i = start;
    while (true) {
      int nextIdx = i + 1 >= s.length() ? -1 : parseBackSlash(s, i + 1);
      if (nextIdx == -1) nextIdx = i + 1;
      if (nextIdx >= s.length() || s.charAt(nextIdx) != '"') break;
      nQuotes++;
      i = nextIdx;
    }
    for (int q = 0; q < nQuotes; q++) {
      if (q == 0 && start == 0 && escapeStartQuote ||
          q % 3 == 2 ||
          q == nQuotes - 1 && i + 1 == s.length() && escapeEndQuote) {
        result.append("\\\"");
      }
      else {
        result.append('"');
      }
    }
    return i + 1;
  }
private static int parseQuotes(int start, @NotNull String s, @NotNull StringBuilder result,
                                 boolean escapeStartQuote, boolean escapeEndQuote)