| 212 | } |
| 213 | |
| 214 | bool cbm_lisp_node_in_quote(CBMArena *a, TSNode node, const char *source) { |
| 215 | TSNode cur = ts_node_parent(node); |
| 216 | for (int guard = 0; guard < CBM_LISP_QUOTE_ANCESTOR_MAX && !ts_node_is_null(cur); guard++) { |
| 217 | const char *ck = ts_node_type(cur); |
| 218 | if ((strcmp(ck, "list") == 0 || strcmp(ck, "list_lit") == 0) && |
| 219 | ts_node_named_child_count(cur) > 0) { |
| 220 | TSNode h = ts_node_named_child(cur, 0); |
| 221 | const char *hk = ts_node_type(h); |
| 222 | if (strcmp(hk, "symbol") == 0 || strcmp(hk, "sym_lit") == 0) { |
| 223 | char *ht = cbm_node_text(a, h, source); |
| 224 | if (ht && |
| 225 | (strcmp(ht, "q") == 0 || strcmp(ht, "quote") == 0 || strcmp(ht, "qq") == 0)) { |
| 226 | return true; |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | cur = ts_node_parent(cur); |
| 231 | } |
| 232 | return false; |
| 233 | } |
| 234 | |
| 235 | TSNode cbm_lisp_named_child_skip_comments(TSNode node, uint32_t want) { |
| 236 | uint32_t nc = ts_node_named_child_count(node); |
no test coverage detected