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

Function parse_func_arg

src/cypher/cypher.c:1581–1600  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1579
1580/* Parse one function argument: a string/number literal or a var[.prop]. */
1581static int parse_func_arg(parser_t *p, cbm_func_arg_t *arg) {
1582 memset(arg, 0, sizeof(*arg));
1583 if (check(p, TOK_STRING) || check(p, TOK_NUMBER)) {
1584 arg->literal = heap_strdup(peek(p)->text);
1585 advance(p);
1586 return 0;
1587 }
1588 const cbm_token_t *var = expect(p, TOK_IDENT);
1589 if (!var) {
1590 return CBM_NOT_FOUND;
1591 }
1592 arg->variable = heap_strdup(var->text);
1593 if (match(p, TOK_DOT)) {
1594 const cbm_token_t *prop = expect(p, TOK_IDENT);
1595 if (prop) {
1596 arg->property = heap_strdup(prop->text);
1597 }
1598 }
1599 return 0;
1600}
1601
1602/* Parse a multi-argument scalar call: coalesce(a, b, ...), substring(s, i[, n]),
1603 * replace(s, from, to), left(s, n), right(s, n). */

Callers 1

parse_multiarg_func_itemFunction · 0.85

Calls 6

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

Tested by

no test coverage detected