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

Function sh_case

src/pipeline/pass_shell.c:2647–2668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2645}
2646
2647static void sh_case(sh_t *s, TSNode n) {
2648 TSNode value = ts_node_child_by_field_name(n, TS_FIELD("value"));
2649 if (!ts_node_is_null(value)) {
2650 sh_walk_substs(s, value); /* case "$(cmd)" in */
2651 }
2652 sh_touch_t t = {0};
2653 for (uint32_t i = 0; i < ts_node_named_child_count(n); i++) {
2654 TSNode item = ts_node_named_child(n, i);
2655 if (!sh_type(item, "case_item")) {
2656 continue;
2657 }
2658 sh_mark_t m = sh_mark(s);
2659 for (uint32_t j = 0; j < ts_node_child_count(item); j++) {
2660 TSNode c = ts_node_child(item, j);
2661 if (ts_node_is_named(c) && !sh_eq(ts_node_field_name_for_child(item, j), "value")) {
2662 sh_walk(s, c);
2663 }
2664 }
2665 sh_clause_end(s, m, &t);
2666 }
2667 sh_group_end(s, &t);
2668}
2669
2670/* A loop's body runs zero or more times, with its variable unknown. */
2671static void sh_loop(sh_t *s, TSNode n) {

Callers 1

sh_walkFunction · 0.85

Calls 7

sh_walk_substsFunction · 0.85
sh_typeFunction · 0.85
sh_markFunction · 0.85
sh_eqFunction · 0.85
sh_walkFunction · 0.85
sh_clause_endFunction · 0.85
sh_group_endFunction · 0.85

Tested by

no test coverage detected