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

Function parse_value_literal

src/cypher/cypher.c:1401–1425  ·  view source on GitHub ↗

Parse a value literal: string, number, ident[.prop], true, false. Returns heap-allocated. */

Source from the content-addressed store, hash-verified

1399
1400/* Parse a value literal: string, number, ident[.prop], true, false. Returns heap-allocated. */
1401static const char *parse_value_literal(parser_t *p) {
1402 if (check(p, TOK_STRING) || check(p, TOK_NUMBER)) {
1403 return heap_strdup(advance(p)->text);
1404 }
1405 if (check(p, TOK_IDENT)) {
1406 char buf[CBM_SZ_256];
1407 const cbm_token_t *v = advance(p);
1408 if (match(p, TOK_DOT)) {
1409 const cbm_token_t *pr = expect(p, TOK_IDENT);
1410 snprintf(buf, sizeof(buf), "%s.%s", v->text, pr ? pr->text : "");
1411 } else {
1412 snprintf(buf, sizeof(buf), "%s", v->text);
1413 }
1414 return heap_strdup(buf);
1415 }
1416 if (check(p, TOK_TRUE)) {
1417 advance(p);
1418 return heap_strdup("true");
1419 }
1420 if (check(p, TOK_FALSE)) {
1421 advance(p);
1422 return heap_strdup("false");
1423 }
1424 return NULL;
1425}
1426
1427/* Parse CASE WHEN ... THEN ... [ELSE ...] END */
1428static cbm_case_expr_t *parse_case_expr(parser_t *p) {

Callers 1

parse_case_exprFunction · 0.85

Calls 5

matchFunction · 0.85
expectFunction · 0.85
checkFunction · 0.70
heap_strdupFunction · 0.70
advanceFunction · 0.70

Tested by

no test coverage detected