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

Function nasm_wrapped_label

internal/cbm/extract_unified.c:2180–2199  ·  view source on GitHub ↗

NASM labels and instructions are flat siblings. For an actual instruction, * find the nearest preceding label at the first ancestor level that has one. * This is structural scope recovery; the instruction mnemonic is not used. */

Source from the content-addressed store, hash-verified

2178 * find the nearest preceding label at the first ancestor level that has one.
2179 * This is structural scope recovery; the instruction mnemonic is not used. */
2180static TSNode nasm_wrapped_label(TSNode node, int remaining_depth) {
2181 if (ts_node_is_null(node) || remaining_depth < 0) {
2182 return (TSNode){0};
2183 }
2184 if (strcmp(ts_node_type(node), "label") == 0) {
2185 return node;
2186 }
2187 const char *kind = ts_node_type(node);
2188 if (strcmp(kind, "instruction") != 0 && strcmp(kind, "source_line") != 0) {
2189 return (TSNode){0};
2190 }
2191 uint32_t count = ts_node_named_child_count(node);
2192 for (uint32_t i = 0; i < count; i++) {
2193 TSNode label = nasm_wrapped_label(ts_node_named_child(node, i), remaining_depth - 1);
2194 if (!ts_node_is_null(label)) {
2195 return label;
2196 }
2197 }
2198 return (TSNode){0};
2199}
2200
2201static TSNode nasm_preceding_label(TSNode node) {
2202 TSNode current = node;

Callers 1

nasm_preceding_labelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected