── Node-type classification: TSSymbol bitset acceleration ─────────────── * cbm_kind_in_set is called for nearly every AST node (function/class/call/ * import/branching sets), so a linear strcmp over the type-name array is a hot * path. tree-sitter already assigns each node type a small integer TSSymbol, so * we precompute — per (language, type-array) — a bitset of the matching symbol * ids a
| 495 | * set (exact=false) and we fall back to the exact strcmp behavior — so the |
| 496 | * result is always identical to the original, only faster. */ |
| 497 | static bool kind_in_set_strcmp(TSNode node, const char *const *types) { |
| 498 | const char *kind = ts_node_type(node); |
| 499 | for (const char *const *t = types; *t; t++) { |
| 500 | if (strcmp(kind, *t) == 0) { |
| 501 | return true; |
| 502 | } |
| 503 | } |
| 504 | return false; |
| 505 | } |
| 506 | |
| 507 | typedef struct { |
| 508 | const TSLanguage *lang; /* NULL = empty slot */ |