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

Function py_conf_block

internal/cbm/doclink_py.c:234–253  ·  view source on GitHub ↗

conf_dict_block: ^name\s*=\s*\{(.*?)^\} -- the text between, or false. */

Source from the content-addressed store, hash-verified

232
233/* conf_dict_block: ^name\s*=\s*\{(.*?)^\} -- the text between, or false. */
234static bool py_conf_block(const char *s, size_t n, const char *name, size_t *a, size_t *b) {
235 for (size_t line = 0; line < n;) {
236 size_t i = py_assign_at(s, n, line, name);
237 if (i > 0 && i < n && s[i] == '{') {
238 size_t k = i + 1;
239 while (k < n) {
240 if (s[k] == '}' && (k == 0 || s[k - 1] == '\n')) {
241 *a = i + 1;
242 *b = k;
243 return true;
244 }
245 k++;
246 }
247 return false;
248 }
249 const char *nl = memchr(s + line, '\n', n - line);
250 line = nl ? (size_t)(nl - s) + 1 : n;
251 }
252 return false;
253}
254
255/* ["']([\w.-]+)["'] at s[i] (extra: also '.'): its end after the closing quote, or 0. */
256static size_t py_quoted_key(const char *s, size_t n, size_t i, bool dots, size_t *ka, size_t *kb) {

Callers 1

py_confFunction · 0.85

Calls 1

py_assign_atFunction · 0.85

Tested by

no test coverage detected