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

Function rs_path_of

internal/cbm/doclink_rs.c:2247–2272  ·  view source on GitHub ↗

A written path (`a::b::C`, `crate::x`, `::std::fmt`) of the node's text, * whitespace removed: copied into `out` when it holds nothing but segments. * false for a type that is no path (a reference, a tuple, generics inside). */

Source from the content-addressed store, hash-verified

2245 * whitespace removed: copied into `out` when it holds nothing but segments.
2246 * false for a type that is no path (a reference, a tuple, generics inside). */
2247static bool rs_path_of(const rs_scan_t *s, TSNode n, char *out, size_t cap) {
2248 if (ts_node_is_null(n)) {
2249 return false;
2250 }
2251 uint32_t a = ts_node_start_byte(n);
2252 uint32_t b = ts_node_end_byte(n);
2253 if (b <= a || b > s->src_len) {
2254 return false;
2255 }
2256 size_t w = 0;
2257 for (uint32_t i = a; i < b; i++) {
2258 char c = s->src[i];
2259 if (isspace((unsigned char)c)) {
2260 continue;
2261 }
2262 if (w + SKIP_ONE >= cap) {
2263 return false;
2264 }
2265 out[w++] = c;
2266 }
2267 out[w] = '\0';
2268 CBMDocLinkRsPath path;
2269 return w > 0 && !memchr(out, '<', w) && !memchr(out, '@', w) && !memchr(out, '!', w) &&
2270 !memchr(out, '(', w) &&
2271 cbm_doclink_rs_parse_path(out, w, false, &path) == CBM_DOCLINK_RS_PATH_OK;
2272}
2273
2274/* ── Scope scan: definitions ─────────────────────────────────────── */
2275

Callers 2

rs_use_joinFunction · 0.85
rs_type_pathFunction · 0.85

Calls 1

Tested by

no test coverage detected