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

Function pod_classify

internal/cbm/extract_defs.c:2385–2414  ·  view source on GitHub ↗

Classify one command paragraph; `depth` is the =over nesting. */

Source from the content-addressed store, hash-verified

2383
2384/* Classify one command paragraph; `depth` is the =over nesting. */
2385static pod_cmd_t pod_classify(const char *src, uint32_t sb, uint32_t eb, int *depth) {
2386 uint32_t wb = sb + SKIP_ONE;
2387 while (wb < eb && (isalnum((unsigned char)src[wb]) || src[wb] == '_')) {
2388 wb++;
2389 }
2390 const char *w = src + sb + SKIP_ONE;
2391 size_t wl = wb - sb - SKIP_ONE;
2392 pod_cmd_t c = {sb, eb, wb, POD_OTHER, 0};
2393 size_t head_len = strlen("head");
2394 if (wl == head_len + SKIP_ONE && strncmp(w, "head", head_len) == 0 &&
2395 isdigit((unsigned char)w[head_len])) {
2396 c.type = POD_HEAD;
2397 c.level = (uint8_t)(w[head_len] - '0');
2398 } else if (pod_word_is(w, wl, "item")) {
2399 c.type = POD_ITEM;
2400 c.level = (uint8_t)*depth;
2401 } else if (pod_word_is(w, wl, "over")) {
2402 c.type = POD_OVER;
2403 (*depth)++;
2404 } else if (pod_word_is(w, wl, "back")) {
2405 c.type = POD_BACK;
2406 c.level = (uint8_t)*depth;
2407 if (*depth > 0) {
2408 (*depth)--;
2409 }
2410 } else if (pod_word_is(w, wl, "cut")) {
2411 c.type = POD_CUT;
2412 }
2413 return c;
2414}
2415
2416/* Command paragraphs of one POD block, in order. */
2417static int pod_commands(CBMArena *a, const char *src, uint32_t pb, uint32_t pe, pod_cmd_t **out) {

Callers 2

pod_commandsFunction · 0.85
pod_run_has_textFunction · 0.85

Calls 1

pod_word_isFunction · 0.85

Tested by

no test coverage detected