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

Function parse_section

internal/cbm/lsp/rust_cargo.c:120–134  ·  view source on GitHub ↗

Parse `[section.path]` header — returns the section name as a flat * dotted string, e.g. "dependencies" or "workspace.dependencies". */

Source from the content-addressed store, hash-verified

118/* Parse `[section.path]` header — returns the section name as a flat
119 * dotted string, e.g. "dependencies" or "workspace.dependencies". */
120static int parse_section(CBMArena* a, const char* s, int len, int from,
121 const char** out) {
122 if (from >= len || s[from] != '[') return from;
123 /* Skip leading `[` or `[[`. */
124 bool array_of_tables = false;
125 from++;
126 if (from < len && s[from] == '[') { array_of_tables = true; from++; }
127 int start = from;
128 while (from < len && s[from] != ']') from++;
129 *out = cbm_arena_strndup(a, s + start, (size_t)(from - start));
130 /* Consume closing `]` (or `]]`). */
131 if (from < len) from++;
132 if (array_of_tables && from < len && s[from] == ']') from++;
133 return from;
134}
135
136/* For the `[dependencies]` / `[dev-dependencies]` / `[workspace.dependencies]`
137 * sections, parse `key = value` lines until the next section. The value

Callers 1

cbm_cargo_parseFunction · 0.85

Calls 1

cbm_arena_strndupFunction · 0.50

Tested by

no test coverage detected