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

Function ts_push

internal/cbm/doclink_ts.c:138–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138static void ts_push(const ts_emit_t *em, const char *ref, size_t n, int syntax, uint32_t line) {
139 if (n == 0) {
140 return;
141 }
142 if (n > CBM_DOCLINK_TS_REF_MAX) {
143 n = CBM_DOCLINK_TS_REF_MAX + SKIP_ONE; /* clipped: the resolver calls it unparseable */
144 }
145 if (ts_is_url(ref, n)) {
146 syntax = CBM_DOCLINK_HREF;
147 } else {
148 size_t k = 0;
149 while (k < n && ts_ident_char(ref[k])) {
150 k++;
151 }
152 if (k == n && ts_is_param(em->def, ref, n)) {
153 return; /* the declaration's own parameter */
154 }
155 }
156 char *copy = cbm_arena_strndup(em->ctx->arena, ref, n);
157 if (!copy) {
158 return;
159 }
160 CBMDocLink link = {
161 .source_qn = em->def->qualified_name,
162 .raw = copy,
163 .line = line,
164 .def_line = em->def->start_line,
165 .syntax = (uint16_t)syntax,
166 };
167 cbm_doclinks_push(&em->ctx->result->doc_links, em->ctx->arena, link);
168}
169
170/* One doc line: its text after the leading `*`, and its source line. */
171typedef struct {

Callers 2

ts_line_inlineFunction · 0.85
ts_line_seeFunction · 0.85

Calls 5

ts_is_urlFunction · 0.85
ts_ident_charFunction · 0.85
ts_is_paramFunction · 0.85
cbm_doclinks_pushFunction · 0.85
cbm_arena_strndupFunction · 0.70

Tested by

no test coverage detected