Finds in @p str the position of a fitting closing angle bracket for the opening angle bracket @p str[@p pos] == '<'. @return the position of a fitting closing bracket or str.size() if not found.
| 258 | /// Finds in @p str the position of a fitting closing angle bracket for the opening angle bracket @p str[@p pos] == '<'. |
| 259 | /// @return the position of a fitting closing bracket or str.size() if not found. |
| 260 | int findClosingAngleBracket(QStringView str, int pos) |
| 261 | { |
| 262 | Q_ASSERT(pos >= 0 && pos < str.size()); |
| 263 | Q_ASSERT(str[pos] == QLatin1Char{'<'}); |
| 264 | |
| 265 | int depth = 1; |
| 266 | |
| 267 | for (++pos; pos < str.size(); ++pos) { |
| 268 | switch (str[pos].unicode()) { |
| 269 | case '<': |
| 270 | if (!isOperator(str, pos)) { |
| 271 | ++depth; |
| 272 | } |
| 273 | break; |
| 274 | case '>': |
| 275 | if (!isOperatorOrArrowOperator(str, pos)) { |
| 276 | if (--depth == 0) { |
| 277 | return pos; |
| 278 | } |
| 279 | } |
| 280 | break; |
| 281 | case '(': |
| 282 | case '[': |
| 283 | case '{': |
| 284 | pos = findClosingNonAngleBracket(str, pos); |
| 285 | break; |
| 286 | default: |
| 287 | pos = trySkipStringOrCharLiteralOrComment(str, pos); |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | Q_ASSERT(depth > 0); |
| 292 | return str.size(); |
| 293 | } |
| 294 | |
| 295 | /// Finds in @p str the position of @p parens[0] or @p parens[2] starting from @p pos at the top level. |
| 296 | /// @return the position of the found symbol or str.size() if not found. |
no test coverage detected