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

Function pod_index_block

internal/cbm/extract_defs.c:2575–2594  ·  view source on GitHub ↗

Index the named =head / =item sections of one POD block. */

Source from the content-addressed store, hash-verified

2573
2574/* Index the named =head / =item sections of one POD block. */
2575static void pod_index_block(CBMExtractCtx *ctx, pod_index_t *ix, TSNode pod) {
2576 CBMArena *a = doc_scratch(ctx);
2577 uint32_t pb = ts_node_start_byte(pod);
2578 uint32_t pe = ts_node_end_byte(pod);
2579 pod_cmd_t *cmds = NULL;
2580 int n = pod_commands(a, ctx->source, pb, pe, &cmds);
2581 for (int ci = 0; ci < n; ci++) {
2582 if (cmds[ci].type != POD_HEAD && cmds[ci].type != POD_ITEM) {
2583 continue;
2584 }
2585 const char *nm = NULL;
2586 size_t nl = pod_heading_name(a, ctx->source, cmds[ci].wb, cmds[ci].eb, &nm);
2587 if (nl == 0) {
2588 continue;
2589 }
2590 uint32_t se = pod_section_end(cmds, n, ci, pe);
2591 pod_sec_t sec = {nm, nl, cmds[ci].sb, pod_trim_end(ctx->source, cmds[ci].sb, se), false};
2592 pod_index_push(a, ix, &sec);
2593 }
2594}
2595
2596/* The file's POD sections by name, built on the first Perl sub (or for the
2597 * module doc of a file without one). */

Callers 1

pod_indexFunction · 0.85

Calls 6

doc_scratchFunction · 0.85
pod_commandsFunction · 0.85
pod_heading_nameFunction · 0.85
pod_section_endFunction · 0.85
pod_trim_endFunction · 0.85
pod_index_pushFunction · 0.85

Tested by

no test coverage detected