A command word: its value; an option whose value is unknown is still that * option (--context="${ctx}" -> "--context="). */
| 957 | /* A command word: its value; an option whose value is unknown is still that |
| 958 | * option (--context="${ctx}" -> "--context="). */ |
| 959 | static 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. */ |
| 973 | static const sh_val_t *sh_array_word(sh_t *s, TSNode w) { |
no test coverage detected