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

Function cbm_cypher_parse

src/cypher/cypher.c:2176–2200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2174/* ── Convenience: lex + parse ───────────────────────────────────── */
2175
2176int cbm_cypher_parse(const char *query, cbm_query_t **out, char **error) {
2177 *out = NULL;
2178 *error = NULL;
2179
2180 cbm_lex_result_t lr = {0};
2181 if (cbm_lex(query, &lr) < 0 || lr.error) {
2182 *error = heap_strdup(lr.error ? lr.error : "lex error");
2183 cbm_lex_free(&lr);
2184 return CBM_NOT_FOUND;
2185 }
2186
2187 cbm_parse_result_t pr = {0};
2188 if (cbm_parse(lr.tokens, lr.count, &pr) < 0) {
2189 *error = heap_strdup(pr.error ? pr.error : "parse error");
2190 cbm_parse_free(&pr);
2191 cbm_lex_free(&lr);
2192 return CBM_NOT_FOUND;
2193 }
2194
2195 *out = pr.query;
2196 pr.query = NULL;
2197 cbm_parse_free(&pr);
2198 cbm_lex_free(&lr);
2199 return 0;
2200}
2201
2202/* ══════════════════════════════════════════════════════════════════
2203 * EXECUTOR

Callers 2

cbm_cypher_executeFunction · 0.85
test_cypher.cFile · 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