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

Function parse_post_where

src/cypher/cypher.c:2014–2040  ·  view source on GitHub ↗

Parse post-WHERE clauses: additional MATCH, WITH, RETURN. A UNION keyword * is left for cbm_parse, which reads the branches in a loop. */

Source from the content-addressed store, hash-verified

2012/* Parse post-WHERE clauses: additional MATCH, WITH, RETURN. A UNION keyword
2013 * is left for cbm_parse, which reads the branches in a loop. */
2014static int parse_post_where(parser_t *p, cbm_query_t *q, int *pat_cap) {
2015 /* More MATCH / OPTIONAL MATCH after WHERE */
2016 if (parse_match_chain(p, q, pat_cap) < 0) {
2017 return CBM_NOT_FOUND;
2018 }
2019 /* Check for unsupported keywords */
2020 const char *unsup = unsupported_clause_error(peek(p)->type);
2021 if (unsup) {
2022 snprintf(p->error, sizeof(p->error), "%s", unsup);
2023 return CBM_NOT_FOUND;
2024 }
2025 /* Optional WITH clause (standalone, not STARTS WITH) */
2026 if (check(p, TOK_WITH) &&
2027 (p->pos < PAIR_LEN || p->tokens[p->pos - SKIP_ONE].type != TOK_STARTS)) {
2028 if (parse_return_or_with(p, &q->with_clause, true) < 0) {
2029 return CBM_NOT_FOUND;
2030 }
2031 if (parse_where(p, &q->post_with_where) < 0) {
2032 return CBM_NOT_FOUND;
2033 }
2034 }
2035 /* Optional RETURN */
2036 if (parse_return(p, &q->ret) < 0) {
2037 return CBM_NOT_FOUND;
2038 }
2039 return 0;
2040}
2041
2042/* A stage that failed without writing a message gets the stage's own. */
2043static void parse_error_default(parser_t *p, const char *msg) {

Callers 1

parse_query_blockFunction · 0.85

Calls 7

parse_match_chainFunction · 0.85
unsupported_clause_errorFunction · 0.85
peekFunction · 0.85
parse_return_or_withFunction · 0.85
parse_whereFunction · 0.85
parse_returnFunction · 0.85
checkFunction · 0.70

Tested by

no test coverage detected