message: Handle escaped commas in parsed arguments
diff: @@ -3333,18 +3333,42 @@ namespace {
  std::vector<String>& res) {
  String filtersString;
  if(parseOption(argc, argv, pattern, &filtersString)) {
  - // tokenize with "," as a separator
  - // cppcheck-suppress strtokCalled
  - DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wdeprecated-declarations")
  - auto pch = std::strtok(filtersString.c_str(), ","); // modifies the string
  - while(pch != nullptr) {
  - if(strlen(pch))
  - res.push_back(pch);
  - // uses the strtok() internal state to go to the next token
  - // cppcheck-suppress strtokCalled
  - pch = std::strtok(nullptr, ",");
  + // tokenize with "," as a separator, unless escaped with backslash
  + std::ostringstream s;
  + auto flush = [&s, &res]() {
  + auto string = s.str();
  + if(string.size() > 0) {
  + res.push_back(string.c_str());
  }
  - DOCTEST_CLANG_SUPPRESS_WARNING_POP
  + s.str("");
  + };
  +
  + bool seenBackslash = false;
  + const char* current = filtersString.c_str();
  + const char* end = current + strlen(current);
  + while(current != end) {
  + char character = *current++;
  + if(seenBackslash) {
  + seenBackslash = false;
  + if(character == ',') {
  + s.put(',');
  + continue;
  + }
  + s.put('\\');
  + }
  + if(character == '\\') {
  + seenBackslash = true;
  + } else if(character == ',') {
  + flush();
  + } else {
  + s.put(character);
  + }
  + }
  +
  + if(seenBackslash) {
  + s.put('\\');
  + }
  + flush();
  return true;
  }
  return false;
  