| 267 | } |
| 268 | |
| 269 | static inline size_t findLineSplitPoint (std::string_view text, size_t targetLength) |
| 270 | { |
| 271 | size_t pos = 0; |
| 272 | char currentQuote = 0; |
| 273 | auto canBreakAfterChar = [] (char c) { return c == ' ' || c == '\t' || c == ',' || c == ';' || c == '\n'; }; |
| 274 | |
| 275 | for (;;) |
| 276 | { |
| 277 | if (pos == text.length()) |
| 278 | return pos; |
| 279 | |
| 280 | auto c = text[pos++]; |
| 281 | |
| 282 | if (pos >= targetLength && currentQuote == 0 && canBreakAfterChar (c)) |
| 283 | return pos; |
| 284 | |
| 285 | if (c == '"' || c == '\'') |
| 286 | { |
| 287 | if (currentQuote == 0) currentQuote = c; |
| 288 | else if (currentQuote == c) currentQuote = 0; |
| 289 | } |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | inline void CodePrinter::append (std::string s) |
| 294 | { |