Is this an identifier-like node that represents a reference?
| 47 | |
| 48 | // Is this an identifier-like node that represents a reference? |
| 49 | static bool is_reference_node(TSNode node, CBMLanguage lang) { |
| 50 | const char *kind = ts_node_type(node); |
| 51 | |
| 52 | // Common identifier types across languages |
| 53 | if (strcmp(kind, "identifier") == 0 || strcmp(kind, "simple_identifier") == 0 || |
| 54 | strcmp(kind, "type_identifier") == 0) { |
| 55 | return true; |
| 56 | } |
| 57 | |
| 58 | // Language-specific reference types |
| 59 | switch (lang) { |
| 60 | case CBM_LANG_GO: |
| 61 | return strcmp(kind, "field_identifier") == 0 || strcmp(kind, "package_identifier") == 0; |
| 62 | case CBM_LANG_PYTHON: |
| 63 | return strcmp(kind, "attribute") == 0; |
| 64 | case CBM_LANG_RUST: |
| 65 | return strcmp(kind, "field_identifier") == 0 || strcmp(kind, "scoped_identifier") == 0; |
| 66 | case CBM_LANG_HASKELL: |
| 67 | return strcmp(kind, "variable") == 0 || strcmp(kind, "constructor") == 0; |
| 68 | case CBM_LANG_OCAML: |
| 69 | return strcmp(kind, "value_path") == 0 || strcmp(kind, "constructor_path") == 0; |
| 70 | case CBM_LANG_ERLANG: |
| 71 | return strcmp(kind, "atom") == 0 || strcmp(kind, "var") == 0; |
| 72 | default: |
| 73 | return false; |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | // Check if a reference node is a definition name (the "name" field of its parent). |
| 78 | static bool is_definition_name(TSNode node) { |
no outgoing calls
no test coverage detected