Find the path node inside a preproc_include/preproc_import node.
| 1134 | |
| 1135 | // Find the path node inside a preproc_include/preproc_import node. |
| 1136 | static TSNode find_include_path_node(TSNode node) { |
| 1137 | TSNode path_node = ts_node_child_by_field_name(node, TS_FIELD("path")); |
| 1138 | if (ts_node_is_null(path_node)) { |
| 1139 | uint32_t nc = ts_node_child_count(node); |
| 1140 | for (uint32_t j = 0; j < nc; j++) { |
| 1141 | TSNode c = ts_node_child(node, j); |
| 1142 | const char *ck = ts_node_type(c); |
| 1143 | if (strcmp(ck, "string_literal") == 0 || strcmp(ck, "system_lib_string") == 0) { |
| 1144 | return c; |
| 1145 | } |
| 1146 | } |
| 1147 | } |
| 1148 | return path_node; |
| 1149 | } |
| 1150 | |
| 1151 | // Strip angle brackets from a system include path (<stdio.h> → stdio.h). |
| 1152 | static char *strip_angle_brackets(CBMArena *a, char *path) { |
no outgoing calls
no test coverage detected