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

Function sh_eval_word

src/pipeline/pass_shell.c:959–970  ·  view source on GitHub ↗

A command word: its value; an option whose value is unknown is still that * option (--context="${ctx}" -> "--context="). */

Source from the content-addressed store, hash-verified

957/* A command word: its value; an option whose value is unknown is still that
958 * option (--context="${ctx}" -> "--context="). */
959static const char *sh_eval_word(sh_t *s, TSNode w) {
960 const char *v = sh_eval(s, w);
961 if (v || s->src[ts_node_start_byte(w)] != '-') {
962 return v;
963 }
964 uint32_t b = ts_node_start_byte(w);
965 uint32_t e = b;
966 while (e < ts_node_end_byte(w) && !strchr("$\"'`\\", s->src[e])) {
967 e++;
968 }
969 return cbm_arena_strndup(s->a, s->src + b, e - b);
970}
971
972/* "${name[@]}" / ${name[*]} as a whole word: the array, NULL when not. */
973static const sh_val_t *sh_array_word(sh_t *s, TSNode w) {

Callers 2

sh_argv_wordFunction · 0.85
sh_assignFunction · 0.85

Calls 2

sh_evalFunction · 0.85
cbm_arena_strndupFunction · 0.50

Tested by

no test coverage detected