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

Function parse_func_arg

src/cypher/cypher.c:1551–1570  ·  view source on GitHub ↗

Parse one function argument: a string/number literal or a var[.prop]. */

Source from the content-addressed store, hash-verified

1549
1550/* Parse one function argument: a string/number literal or a var[.prop]. */
1551static int parse_func_arg(parser_t *p, cbm_func_arg_t *arg) {
1552 memset(arg, 0, sizeof(*arg));
1553 if (check(p, TOK_STRING) || check(p, TOK_NUMBER)) {
1554 arg->literal = heap_strdup(peek(p)->text);
1555 advance(p);
1556 return 0;
1557 }
1558 const cbm_token_t *var = expect(p, TOK_IDENT);
1559 if (!var) {
1560 return CBM_NOT_FOUND;
1561 }
1562 arg->variable = heap_strdup(var->text);
1563 if (match(p, TOK_DOT)) {
1564 const cbm_token_t *prop = expect(p, TOK_IDENT);
1565 if (prop) {
1566 arg->property = heap_strdup(prop->text);
1567 }
1568 }
1569 return 0;
1570}
1571
1572/* Parse a multi-argument scalar call: coalesce(a, b, ...), substring(s, i[, n]),
1573 * replace(s, from, to), left(s, n), right(s, n). */

Callers 1

parse_multiarg_func_itemFunction · 0.85

Calls 6

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

Tested by

no test coverage detected