The anchors every Doxygen comment of the file defines. */
| 694 | |
| 695 | /* The anchors every Doxygen comment of the file defines. */ |
| 696 | static void c_scope_anchors(CBMExtractCtx *ctx, c_sb_t *sb) { |
| 697 | TSTreeCursor cur = ts_tree_cursor_new(ctx->root); |
| 698 | for (bool more = ts_tree_cursor_goto_first_child(&cur); more;) { |
| 699 | TSNode n = ts_tree_cursor_current_node(&cur); |
| 700 | if (c_kind(n, "comment") && c_doc_style(ctx->source, n)) { |
| 701 | uint32_t b = ts_node_start_byte(n); |
| 702 | char *text = cbm_arena_strndup(sb->a, ctx->source + b, ts_node_end_byte(n) - b); |
| 703 | if (text) { |
| 704 | c_anchors(sb, text); |
| 705 | } |
| 706 | } |
| 707 | if (!c_kind(n, "compound_statement") && ts_tree_cursor_goto_first_child(&cur)) { |
| 708 | continue; |
| 709 | } |
| 710 | while (!ts_tree_cursor_goto_next_sibling(&cur)) { |
| 711 | if (!ts_tree_cursor_goto_parent(&cur)) { |
| 712 | more = false; |
| 713 | break; |
| 714 | } |
| 715 | } |
| 716 | } |
| 717 | ts_tree_cursor_delete(&cur); |
| 718 | } |
| 719 | |
| 720 | const char *cbm_doclink_c_scan_scope(CBMExtractCtx *ctx) { |
| 721 | if (!ctx || !ctx->result || ts_node_is_null(ctx->root) || !c_leg_file(ctx->rel_path)) { |
no test coverage detected