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

Function go_parse_spans

internal/cbm/doclink_go.c:833–858  ·  view source on GitHub ↗

go/doc/comment parseSpans. A line is looked at as unindented text at most * once and as part of an indented run at most once. */

Source from the content-addressed store, hash-verified

831/* go/doc/comment parseSpans. A line is looked at as unindented text at most
832 * once and as part of an indented run at most once. */
833static void go_parse_spans(go_doc_t *d) {
834 int i = 0;
835 int force_indent = 0;
836 while (!d->failed) {
837 while (i < d->nlines && d->lines[i].len == 0) {
838 i++;
839 }
840 if (i >= d->nlines) {
841 return;
842 }
843 int kind = GO_SPAN_PARA;
844 bool indented = i < force_indent || go_indented(&d->lines[i]);
845 int end = indented ? go_indented_span(d, i, force_indent, &kind)
846 : go_unindented_span(d, i, &force_indent);
847 if (end == i) {
848 continue; /* every line was left for the block: now force-indented */
849 }
850 if (!indented && end == i + SKIP_ONE && go_is_heading(&d->lines[i])) {
851 kind = GO_SPAN_HEADING; /* one unindented line: `# Title` */
852 }
853 if (!go_push_span(d, i, end, kind)) {
854 return;
855 }
856 i = end;
857 }
858}
859
860/* ── Link definitions ────────────────────────────────────────────── */
861

Callers 1

cbm_doclink_go_parse_docFunction · 0.85

Calls 5

go_indentedFunction · 0.85
go_indented_spanFunction · 0.85
go_unindented_spanFunction · 0.85
go_is_headingFunction · 0.85
go_push_spanFunction · 0.85

Tested by

no test coverage detected