| 29 | }; |
| 30 | |
| 31 | bool |
| 32 | parseComment(const std::string &comment, |
| 33 | CommentKeyValue &out) |
| 34 | { |
| 35 | std::smatch match; |
| 36 | if (!std::regex_match(comment, match, sCommentKeyValueRegex)) { |
| 37 | if (std::regex_match(comment, match, sCommentKeyValueStartRegex)) { |
| 38 | throw gfd_header_parse_exception { |
| 39 | fmt::format("Syntax error in comment {}", comment) |
| 40 | }; |
| 41 | } |
| 42 | |
| 43 | return false; |
| 44 | } |
| 45 | |
| 46 | out.obj = match[1]; |
| 47 | out.index = match[2]; |
| 48 | out.member = match[3]; |
| 49 | out.value = match[4]; |
| 50 | |
| 51 | if (out.value.size() >= 2 && out.value[0] == '"') { |
| 52 | // Erase quotes from string value |
| 53 | out.value.erase(out.value.begin()); |
| 54 | out.value.erase(out.value.end() - 1); |
| 55 | } |
| 56 | |
| 57 | return true; |
| 58 | } |
| 59 | |
| 60 | void |
| 61 | ensureArrayOfObjects(const CommentKeyValue &kv) |
no test coverage detected