MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / parse_path

Function parse_path

src/pipeline/doc_links_cs.c:3449–3470  ·  view source on GitHub ↗

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. */

Source from the content-addressed store, hash-verified

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. */
3449static 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
3472static const char *const CS_KEYWORD_TYPES[][2] = {
3473 {"int", "Int32"}, {"string", "String"}, {"object", "Object"}, {"bool", "Boolean"},

Callers 2

parse_crefFunction · 0.85
parse_nameFunction · 0.85

Calls 3

is_open_bracketFunction · 0.85
is_close_bracketFunction · 0.85
parse_segFunction · 0.85

Tested by

no test coverage detected