The mapping a node holds (a YAML block or flow mapping, a JSON object), * through the wrappers around it; a null node for none. */
| 40 | /* The mapping a node holds (a YAML block or flow mapping, a JSON object), |
| 41 | * through the wrappers around it; a null node for none. */ |
| 42 | static TSNode oa_mapping(TSNode n) { |
| 43 | for (int k = 0; k < OA_UNWRAP_MAX && !ts_node_is_null(n); k++) { |
| 44 | if (oa_is(n, "block_mapping") || oa_is(n, "flow_mapping") || oa_is(n, "object")) { |
| 45 | return n; |
| 46 | } |
| 47 | if (!oa_is(n, "stream") && !oa_is(n, "document") && !oa_is(n, "block_node") && |
| 48 | !oa_is(n, "flow_node")) { |
| 49 | break; |
| 50 | } |
| 51 | TSNode next = {0}; |
| 52 | uint32_t nc = ts_node_named_child_count(n); |
| 53 | for (uint32_t i = 0; i < nc && ts_node_is_null(next); i++) { |
| 54 | TSNode c = ts_node_named_child(n, i); |
| 55 | if (!oa_is(c, "comment") && !oa_is(c, "anchor") && !oa_is(c, "tag")) { |
| 56 | next = c; |
| 57 | } |
| 58 | } |
| 59 | n = next; |
| 60 | } |
| 61 | return (TSNode){0}; |
| 62 | } |
| 63 | |
| 64 | static bool oa_pair(TSNode n) { |
| 65 | return oa_is(n, "block_mapping_pair") || oa_is(n, "flow_pair") || oa_is(n, "pair"); |
no test coverage detected