| 21 | } sig_case_t; |
| 22 | |
| 23 | static bool find_nth(TSNode n, const char *kind, int *left, TSNode *out) { |
| 24 | if (strcmp(ts_node_type(n), kind) == 0) { |
| 25 | if (*left == 0) { |
| 26 | *out = n; |
| 27 | return true; |
| 28 | } |
| 29 | (*left)--; |
| 30 | } |
| 31 | uint32_t count = ts_node_child_count(n); |
| 32 | for (uint32_t i = 0; i < count; i++) { |
| 33 | if (find_nth(ts_node_child(n, i), kind, left, out)) { |
| 34 | return true; |
| 35 | } |
| 36 | } |
| 37 | return false; |
| 38 | } |
| 39 | |
| 40 | /* Parse `source`, build the nth `kind` node's suffix in `mode`; the returned |
| 41 | * string is arena-owned (NULL when absent). */ |
no outgoing calls
no test coverage detected