The =head / =item sections of the POD block src[pb, pe). */
| 971 | |
| 972 | /* The =head / =item sections of the POD block src[pb, pe). */ |
| 973 | static 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. */ |
| 994 | static bool pl_is_cut_line(const char *src, uint32_t i, uint32_t le) { |
no test coverage detected