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

Function pod_module_run

internal/cbm/extract_defs.c:2694–2723  ·  view source on GitHub ↗

Append src[b, e) of the current block to the module doc, after a blank * line, unless it holds no text. */

Source from the content-addressed store, hash-verified

2692/* Append src[b, e) of the current block to the module doc, after a blank
2693 * line, unless it holds no text. */
2694static void pod_module_run(pod_module_t *m, uint32_t b, uint32_t e) {
2695 const char *src = m->ctx->source;
2696 while (b < e) { /* leading blank lines */
2697 uint32_t le = b;
2698 while (le < e && src[le] != '\n') {
2699 le++;
2700 }
2701 if (!pod_line_is_blank(src, b, le)) {
2702 break;
2703 }
2704 b = le < e ? le + SKIP_ONE : e;
2705 }
2706 e = pod_trim_end(src, b, e);
2707 if (b >= e || !pod_run_has_text(src, b, e)) {
2708 return;
2709 }
2710 if (m->first_line == 0) {
2711 uint32_t line = ts_node_start_point(m->block).row + SKIP_ONE;
2712 for (uint32_t k = ts_node_start_byte(m->block); k < b; k++) {
2713 line += src[k] == '\n' ? SKIP_ONE : 0;
2714 }
2715 m->first_line = line;
2716 }
2717 if (m->w > 0) {
2718 m->buf[m->w++] = '\n';
2719 m->buf[m->w++] = '\n';
2720 }
2721 memcpy(m->buf + m->w, src + b, e - b);
2722 m->w += e - b;
2723}
2724
2725/* Perl's module doc, for the File node: the file's POD outside the sections a
2726 * sub's doc holds, so that no reference is read twice. Every POD block with

Callers 1

doc_perl_moduleFunction · 0.85

Calls 3

pod_line_is_blankFunction · 0.85
pod_trim_endFunction · 0.85
pod_run_has_textFunction · 0.85

Tested by

no test coverage detected