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

Function c_scope_anchors

internal/cbm/doclink_c.c:696–718  ·  view source on GitHub ↗

The anchors every Doxygen comment of the file defines. */

Source from the content-addressed store, hash-verified

694
695/* The anchors every Doxygen comment of the file defines. */
696static 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
720const 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)) {

Callers 1

cbm_doclink_c_scan_scopeFunction · 0.85

Calls 4

c_kindFunction · 0.85
c_doc_styleFunction · 0.85
c_anchorsFunction · 0.85
cbm_arena_strndupFunction · 0.70

Tested by

no test coverage detected