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

Function parse_func_arg

src/cypher/cypher.c:1550–1569  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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