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.
| 1006 | // Check if parent node kind matches direct-or-grandparent for scripting languages. |
| 1007 | // Returns true if pk matches root_kind, or pk matches wrapper_kind and grandparent is root_kind. |
| 1008 | static bool check_script_module_level(TSNode parent, const char *pk, const char *root_kind, |
| 1009 | const char *wrapper_kind) { |
| 1010 | if (strcmp(pk, root_kind) == 0) { |
| 1011 | return true; |
| 1012 | } |
| 1013 | if (wrapper_kind && strcmp(pk, wrapper_kind) == 0) { |
| 1014 | TSNode gp = ts_node_parent(parent); |
| 1015 | return !ts_node_is_null(gp) && strcmp(ts_node_type(gp), root_kind) == 0; |
| 1016 | } |
| 1017 | return false; |
| 1018 | } |
| 1019 | |
| 1020 | // Get the module-level parent type list for table-driven languages. |
| 1021 | static const char **get_module_parents(CBMLanguage lang) { |
no outgoing calls
no test coverage detected