Handle YAML files: walk top-level block_mapping recursively */
| 2006 | |
| 2007 | /* Handle YAML files: walk top-level block_mapping recursively */ |
| 2008 | static void handle_yaml_nested(CBMExtractCtx *ctx, TSNode node) { |
| 2009 | if (ctx->language != CBM_LANG_YAML) { |
| 2010 | return; |
| 2011 | } |
| 2012 | const char *kind = ts_node_type(node); |
| 2013 | if (strcmp(kind, "block_mapping") != 0) { |
| 2014 | return; |
| 2015 | } |
| 2016 | /* Only process root-level block_mapping (depth 0 or 1) */ |
| 2017 | TSNode parent = ts_node_parent(node); |
| 2018 | if (ts_node_is_null(parent)) { |
| 2019 | walk_yaml_mapping(ctx, node, NULL); |
| 2020 | } else { |
| 2021 | const char *pk = ts_node_type(parent); |
| 2022 | if (strcmp(pk, "stream") == 0 || strcmp(pk, "document") == 0 || |
| 2023 | strcmp(pk, "block_node") == 0) { |
| 2024 | walk_yaml_mapping(ctx, node, NULL); |
| 2025 | } |
| 2026 | } |
| 2027 | } |
| 2028 | |
| 2029 | // --- Main unified cursor walk --- |
| 2030 |
no test coverage detected