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

Function pl_block_sections

internal/cbm/doclink_perl.c:973–991  ·  view source on GitHub ↗

The =head / =item sections of the POD block src[pb, pe). */

Source from the content-addressed store, hash-verified

971
972/* The =head / =item sections of the POD block src[pb, pe). */
973static void pl_block_sections(pl_scan_t *s, uint32_t pb, uint32_t pe) {
974 pl_block_commands(s, pb, pe);
975 for (int ci = 0; ci < s->ncmds && !s->failed; ci++) {
976 const pl_cmd_t *c = &s->cmds[ci];
977 if (c->type != PL_HEAD && c->type != PL_ITEM) {
978 continue;
979 }
980 pl_sec_t *secs = (pl_sec_t *)pl_grow(s, s->secs, s->nsecs, &s->cap_secs, sizeof(pl_sec_t));
981 if (!secs) {
982 return;
983 }
984 s->secs = secs;
985 pl_sec_t sec = {.sb = c->sb, .hb = c->wb, .he = c->eb, .item = c->type == PL_ITEM};
986 sec.eb = pl_trim_end(s->src, c->sb, pl_section_end(s->cmds, s->ncmds, ci, pe));
987 sec.line = pl_scan_line(s, c->sb);
988 sec.name_len = (uint32_t)pl_heading_name(s->a, s->src, c->wb, c->eb, &sec.name);
989 s->secs[s->nsecs++] = sec;
990 }
991}
992
993/* True when the line src[i, le) is the `=cut` that ends a POD block. */
994static bool pl_is_cut_line(const char *src, uint32_t i, uint32_t le) {

Callers 1

pl_scan_fileFunction · 0.85

Calls 6

pl_block_commandsFunction · 0.85
pl_growFunction · 0.85
pl_trim_endFunction · 0.85
pl_section_endFunction · 0.85
pl_scan_lineFunction · 0.85
pl_heading_nameFunction · 0.85

Tested by

no test coverage detected