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

Function doc_rust_inner

internal/cbm/extract_defs.c:2882–2904  ·  view source on GitHub ↗

Rust inner docs (//! and the bang block) before the first item. */

Source from the content-addressed store, hash-verified

2880
2881/* Rust inner docs (//! and the bang block) before the first item. */
2882static const char *doc_rust_inner(CBMExtractCtx *ctx) {
2883 doc_trivia_t t;
2884 memset(&t, 0, sizeof(t));
2885 TSTreeCursor cur = ts_tree_cursor_new(ctx->root);
2886 if (ts_tree_cursor_goto_first_child(&cur)) {
2887 do {
2888 TSNode ch = ts_tree_cursor_current_node(&cur);
2889 const char *k = ts_node_type(ch);
2890 if (is_comment_node(k)) {
2891 doc_span_t sp = doc_span_of(ch, ctx->source, DOC_SPAN_COMMENT);
2892 if (sp.style == DOC_CS_LINE_BANG || sp.style == DOC_CS_BLOCK_BANG) {
2893 doc_push_span(doc_scratch(ctx), &t, &sp);
2894 }
2895 continue;
2896 }
2897 if (strcmp(k, "inner_attribute_item") != 0) {
2898 break; /* the first item: the inner docs are over */
2899 }
2900 } while (ts_tree_cursor_goto_next_sibling(&cur));
2901 }
2902 ts_tree_cursor_delete(&cur);
2903 return t.count > 0 ? doc_run_text(ctx, &t, 0, t.count - SKIP_ONE, false) : NULL;
2904}
2905
2906/* A file's own doc, for its File node: the Go package comment or the Rust
2907 * inner docs. */

Callers 1

extract_module_docFunction · 0.85

Calls 5

is_comment_nodeFunction · 0.85
doc_span_ofFunction · 0.85
doc_push_spanFunction · 0.85
doc_scratchFunction · 0.85
doc_run_textFunction · 0.85

Tested by

no test coverage detected