Check if parent node kind matches direct-or-grandparent for scripting languages. Returns true if pk matches root_kind, or pk matches wrapper_kind and grandparent is root_kind.
| 1547 | // Check if parent node kind matches direct-or-grandparent for scripting languages. |
| 1548 | // Returns true if pk matches root_kind, or pk matches wrapper_kind and grandparent is root_kind. |
| 1549 | static bool check_script_module_level(TSNode parent, const char *pk, const char *root_kind, |
| 1550 | const char *wrapper_kind) { |
| 1551 | if (strcmp(pk, root_kind) == 0) { |
| 1552 | return true; |
| 1553 | } |
| 1554 | if (wrapper_kind && strcmp(pk, wrapper_kind) == 0) { |
| 1555 | TSNode gp = ts_node_parent(parent); |
| 1556 | return !ts_node_is_null(gp) && strcmp(ts_node_type(gp), root_kind) == 0; |
| 1557 | } |
| 1558 | return false; |
| 1559 | } |
| 1560 | |
| 1561 | // Get the module-level parent type list for table-driven languages. |
| 1562 | static const char **get_module_parents(CBMLanguage lang) { |
no outgoing calls
no test coverage detected