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

Function pl_classify

internal/cbm/doclink_perl.c:807–831  ·  view source on GitHub ↗

Classify one command paragraph; `depth` is the =over nesting * (extract_defs.c's pod_classify). */

Source from the content-addressed store, hash-verified

805/* Classify one command paragraph; `depth` is the =over nesting
806 * (extract_defs.c's pod_classify). */
807static pl_cmd_t pl_classify(const char *src, uint32_t sb, uint32_t eb, int *depth) {
808 uint32_t wb = (uint32_t)pl_command_word_end(src, sb, eb);
809 const char *w = src + sb + SKIP_ONE;
810 size_t wl = wb - sb - SKIP_ONE;
811 pl_cmd_t c = {sb, eb, wb, PL_OTHER, 0};
812 if (pl_head_level(w, wl) > 0) {
813 c.type = PL_HEAD;
814 c.level = (uint8_t)pl_head_level(w, wl);
815 } else if (pl_word_is(w, wl, "item")) {
816 c.type = PL_ITEM;
817 c.level = (uint8_t)*depth;
818 } else if (pl_word_is(w, wl, "over")) {
819 c.type = PL_OVER;
820 (*depth)++;
821 } else if (pl_word_is(w, wl, "back")) {
822 c.type = PL_BACK;
823 c.level = (uint8_t)*depth;
824 if (*depth > 0) {
825 (*depth)--;
826 }
827 } else if (pl_word_is(w, wl, "cut")) {
828 c.type = PL_CUT;
829 }
830 return c;
831}
832
833/* The command paragraphs of the POD block src[pb, pe) into s->cmds. */
834static void pl_block_commands(pl_scan_t *s, uint32_t pb, uint32_t pe) {

Callers 1

pl_block_commandsFunction · 0.85

Calls 3

pl_command_word_endFunction · 0.85
pl_head_levelFunction · 0.85
pl_word_isFunction · 0.85

Tested by

no test coverage detected