70 {
71 auto trimmed = [&] (
size_t start,
size_t end) {
72 while (names[start] == ',' || isspace(names[start])) {
74 }
75 while (names[end] == ',' || isspace(names[end])) {
77 }
78 return names.substr(start, end - start + 1);
79 };
80 auto skipq = [&] (
size_t start,
char quote) {
81 for (auto i = start + 1; i < names.size() ; ++i) {
82 if (names[i] == quote)
83 return i;
84 if (names[i] == '\\')
85 ++i;
86 }
88 };
89
91 std::stack<char> openings;
92 for (size_t pos = 0; pos < names.size(); ++pos) {
93 char c = names[pos];
94 switch (c) {
95 case '[':
96 case '{':
97 case '(':
98
99
100
101 openings.push(c);
102 break;
103 case ']':
104 case '}':
105 case ')':
106
107 openings.pop();
108 break;
109 case '"':
110 case '\'':
111 pos = skipq(pos, c);
112 break;
113 case ',':
114 if (start != pos && openings.size() == 0) {
115 m_messages.emplace_back(macroName, lineInfo, resultType);
116 m_messages.back().message = trimmed(start, pos);
117 m_messages.back().message += " := ";
119 }
120 }
121 }
122 assert(openings.size() == 0 && "Mismatched openings");
123 m_messages.emplace_back(macroName, lineInfo, resultType);
124 m_messages.back().message = trimmed(start, names.size() - 1);
125 m_messages.back().message += " := ";
126 }
#define CATCH_INTERNAL_ERROR(msg)