Split a dotted path (dots inside type-argument groups do not split). */ A path whose brackets do not pair is not read at all: its last segment * would be dropped and the reference resolved by the segments before it. */
| 3447 | /* A path whose brackets do not pair is not read at all: its last segment |
| 3448 | * would be dropped and the reference resolved by the segments before it. */ |
| 3449 | static bool parse_path(const char *s, size_t n, cs_seg_t *segs, int *nsegs) { |
| 3450 | *nsegs = 0; |
| 3451 | size_t start = 0; |
| 3452 | int depth = 0; |
| 3453 | for (size_t i = 0; i <= n; i++) { |
| 3454 | char c = i < n ? s[i] : '.'; |
| 3455 | if (is_open_bracket(c)) { |
| 3456 | depth++; |
| 3457 | } else if (is_close_bracket(c)) { |
| 3458 | if (--depth < 0) { |
| 3459 | return false; |
| 3460 | } |
| 3461 | } else if (c == '.' && depth == 0) { |
| 3462 | if (*nsegs >= CS_MAX_SEGS || !parse_seg(s + start, i - start, &segs[*nsegs])) { |
| 3463 | return false; |
| 3464 | } |
| 3465 | (*nsegs)++; |
| 3466 | start = i + SKIP_ONE; |
| 3467 | } |
| 3468 | } |
| 3469 | return depth == 0 && *nsegs > 0; |
| 3470 | } |
| 3471 | |
| 3472 | static const char *const CS_KEYWORD_TYPES[][2] = { |
| 3473 | {"int", "Int32"}, {"string", "String"}, {"object", "Object"}, {"bool", "Boolean"}, |
no test coverage detected