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

Function cbm_cypher_parse

src/cypher/cypher.c:2294–2318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2292/* ── Convenience: lex + parse ───────────────────────────────────── */
2293
2294int cbm_cypher_parse(const char *query, cbm_query_t **out, char **error) {
2295 *out = NULL;
2296 *error = NULL;
2297
2298 cbm_lex_result_t lr = {0};
2299 if (cbm_lex(query, &lr) < 0 || lr.error) {
2300 *error = heap_strdup(lr.error ? lr.error : "lex error");
2301 cbm_lex_free(&lr);
2302 return CBM_NOT_FOUND;
2303 }
2304
2305 cbm_parse_result_t pr = {0};
2306 if (cbm_parse(lr.tokens, lr.count, &pr) < 0) {
2307 *error = heap_strdup(pr.error ? pr.error : "parse error");
2308 cbm_parse_free(&pr);
2309 cbm_lex_free(&lr);
2310 return CBM_NOT_FOUND;
2311 }
2312
2313 *out = pr.query;
2314 pr.query = NULL;
2315 cbm_parse_free(&pr);
2316 cbm_lex_free(&lr);
2317 return 0;
2318}
2319
2320/* ══════════════════════════════════════════════════════════════════
2321 * EXECUTOR

Callers 3

cbm_cypher_executeFunction · 0.85
test_cypher.cFile · 0.85
fuzz_cypherFunction · 0.85

Calls 5

cbm_lexFunction · 0.85
cbm_lex_freeFunction · 0.85
cbm_parseFunction · 0.85
cbm_parse_freeFunction · 0.85
heap_strdupFunction · 0.70

Tested by

no test coverage detected