The s-expression head symbol text, or NULL if the list has no symbol head. */
| 2421 | |
| 2422 | /* The s-expression head symbol text, or NULL if the list has no symbol head. */ |
| 2423 | static char *lisp_head_text(CBMExtractCtx *ctx, TSNode list, TSNode *out_head) { |
| 2424 | if (ts_node_named_child_count(list) < 1) { |
| 2425 | return NULL; |
| 2426 | } |
| 2427 | TSNode head = ts_node_named_child(list, 0); |
| 2428 | const char *ht = ts_node_type(head); |
| 2429 | if (strcmp(ht, "symbol") != 0 && strcmp(ht, "sym_lit") != 0) { |
| 2430 | return NULL; |
| 2431 | } |
| 2432 | if (out_head) { |
| 2433 | *out_head = head; |
| 2434 | } |
| 2435 | return cbm_node_text(ctx->arena, head, ctx->source); |
| 2436 | } |
| 2437 | |
| 2438 | /* Process one s-expression list as a potential import/namespace form. */ |
| 2439 | static void lisp_process_list(CBMExtractCtx *ctx, TSNode node) { |
no test coverage detected