Classify one command paragraph; `depth` is the =over nesting * (extract_defs.c's pod_classify). */
| 805 | /* Classify one command paragraph; `depth` is the =over nesting |
| 806 | * (extract_defs.c's pod_classify). */ |
| 807 | static 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. */ |
| 834 | static void pl_block_commands(pl_scan_t *s, uint32_t pb, uint32_t pe) { |
no test coverage detected