void (@NotNull StringBuilder result, @NotNull StringNodeInfo info, @NotNull String line) { boolean singleQuoteUsed = false, doubleQuoteUsed = false; int chunkStart = 0; boolean firstChunk = true; for (int k = 0; k <= line.length(); k++) { if (k < line.length()) { singleQuoteUsed |= line.charAt(k) == '\''; doubleQuoteUsed |= line.charAt(k) == '"'; } final char chunkQuote; if ((k == line.length() || line.charAt(k) == '\'') && doubleQuoteUsed) { chunkQuote = '\''; doubleQuoteUsed = false; } else if ((k == line.length() || line.charAt(k) == '"') && singleQuoteUsed) { chunkQuote = '"'; singleQuoteUsed = false; } else if (k == line.length()) { chunkQuote = info.getSingleQuote(); } else { continue; } if (!firstChunk) { result.append(" "); } result.append(info.getPrefix()).append(chunkQuote).append(line, chunkStart, k).append(chunkQuote); firstChunk = false; chunkStart = k; } }