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

Function extract_docstring

internal/cbm/extract_defs.c:1221–1239  ·  view source on GitHub ↗

Extract docstring from the node's leading comment.

Source from the content-addressed store, hash-verified

1219
1220// Extract docstring from the node's leading comment.
1221static const char *extract_docstring(CBMArena *a, TSNode node, const char *source,
1222 CBMLanguage lang) {
1223 if (lang == CBM_LANG_GO) {
1224 const char *doc = extract_go_type_docstring(a, node, source);
1225 if (doc) {
1226 return doc;
1227 }
1228 }
1229
1230 TSNode prev = ts_node_prev_sibling(node);
1231 if (!ts_node_is_null(prev) && is_comment_node(ts_node_type(prev))) {
1232 return extract_comment_text(a, prev, source);
1233 }
1234
1235 if (lang == CBM_LANG_PYTHON) {
1236 return extract_python_docstring(a, node, source);
1237 }
1238 return NULL;
1239}
1240
1241static TSNode find_jvm_modifiers(TSNode node, CBMLanguage lang);
1242

Callers 3

extract_func_defFunction · 0.85
extract_class_defFunction · 0.85
push_method_defFunction · 0.85

Calls 4

is_comment_nodeFunction · 0.85
extract_comment_textFunction · 0.85
extract_python_docstringFunction · 0.85

Tested by

no test coverage detected