TODO: Collect it while walking AST seems better
| 32 | |
| 33 | // TODO: Collect it while walking AST seems better |
| 34 | std::vector<std::pair<size_t, size_t>> findBlocksBetweenFormatSwitch(const std::string& str) { |
| 35 | std::vector<std::pair<size_t, size_t>> blocks; |
| 36 | size_t pos = std::string::npos; |
| 37 | size_t findAt = 0; |
| 38 | std::deque<size_t> startArr; |
| 39 | while ((pos = str.find(DISABLE_FORMAT_BEGIN, findAt)) != std::string::npos) { |
| 40 | startArr.push_back(pos); |
| 41 | findAt = pos + DISABLE_FORMAT_BEGIN.size(); |
| 42 | } |
| 43 | pos = std::string::npos; |
| 44 | findAt = 0; |
| 45 | while ((pos = str.find(DISABLE_FORMAT_END, findAt)) != std::string::npos) { |
| 46 | if (!startArr.empty()) { |
| 47 | size_t start = startArr.front(); |
| 48 | startArr.pop_front(); |
| 49 | blocks.emplace_back(start, pos); |
| 50 | } |
| 51 | findAt = pos + DISABLE_FORMAT_END.size(); |
| 52 | } |
| 53 | return blocks; |
| 54 | } |
| 55 | |
| 56 | static std::string getOSLineSeparator() { |
| 57 | #ifdef _WIN32 |
no outgoing calls
no test coverage detected