| 273 | } |
| 274 | |
| 275 | static const char *fold_node(CBMExtractCtx *ctx, TSNode node, int depth, bool url) { |
| 276 | if (depth > FOLD_MAX_DEPTH || ts_node_is_null(node)) { |
| 277 | return NULL; |
| 278 | } |
| 279 | const char *k = ts_node_type(node); |
| 280 | if (strcmp(k, "string") == 0 || strcmp(k, "template_string") == 0) { |
| 281 | return fold_string_like(ctx, node, depth, url); |
| 282 | } |
| 283 | if (strcmp(k, "identifier") == 0 || strcmp(k, "member_expression") == 0) { |
| 284 | return fold_reference(ctx, node, url); |
| 285 | } |
| 286 | if (strcmp(k, "binary_expression") == 0 || strcmp(k, "binary_operator") == 0) { |
| 287 | return fold_concat(ctx, node, depth, url); |
| 288 | } |
| 289 | if (strcmp(k, "concatenated_string") == 0) { |
| 290 | return fold_implicit_concat(ctx, node, depth, url); |
| 291 | } |
| 292 | if (is_transparent_wrapper(k) && ts_node_named_child_count(node) > 0) { |
| 293 | return fold_node(ctx, ts_node_named_child(node, 0), depth + SKIP_ONE, url); |
| 294 | } |
| 295 | return NULL; |
| 296 | } |
| 297 | |
| 298 | /* --- constants ------------------------------------------------------- */ |
| 299 |
no test coverage detected