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

Function pod_heading_name

internal/cbm/extract_defs.c:2508–2548  ·  view source on GitHub ↗

The sub a heading names: after a list bullet ("*", "1."), a `$obj->` * receiver and a sigil, the identifier that follows. Returns its length * (0: none). */

Source from the content-addressed store, hash-verified

2506 * receiver and a sigil, the identifier that follows. Returns its length
2507 * (0: none). */
2508static size_t pod_heading_name(CBMArena *a, const char *src, uint32_t b, uint32_t e,
2509 const char **name) {
2510 const char *buf = pod_plain_heading(a, src, b, e);
2511 if (!buf) {
2512 return 0;
2513 }
2514 const char *p = pod_skip_spaces(buf);
2515 if (*p == '*') {
2516 p++;
2517 } else if (isdigit((unsigned char)*p)) {
2518 while (isdigit((unsigned char)*p)) {
2519 p++;
2520 }
2521 if (*p == '.') {
2522 p++;
2523 }
2524 }
2525 p = pod_skip_spaces(p);
2526 if (*p == '$') {
2527 const char *q = p + SKIP_ONE;
2528 while (isalnum((unsigned char)*q) || *q == '_') {
2529 q++;
2530 }
2531 q = pod_skip_spaces(q);
2532 if (q > p + SKIP_ONE && q[0] == '-' && q[SKIP_ONE] == '>') {
2533 p = pod_skip_spaces(q + PAIR_LEN);
2534 }
2535 }
2536 if (*p == '$' || *p == '@' || *p == '%' || *p == '&') {
2537 p++;
2538 }
2539 if (!(isalpha((unsigned char)*p) || *p == '_')) {
2540 return 0;
2541 }
2542 const char *s = p;
2543 while (isalnum((unsigned char)*p) || *p == '_') {
2544 p++;
2545 }
2546 *name = s;
2547 return (size_t)(p - s);
2548}
2549
2550static uint32_t pod_trim_end(const char *src, uint32_t sb, uint32_t eb) {
2551 while (eb > sb && (src[eb - SKIP_ONE] == '\n' || src[eb - SKIP_ONE] == '\r' ||

Callers 1

pod_index_blockFunction · 0.85

Calls 2

pod_plain_headingFunction · 0.85
pod_skip_spacesFunction · 0.85

Tested by

no test coverage detected