Extract string value from a node (literal or constant reference).
| 1403 | |
| 1404 | // Extract string value from a node (literal or constant reference). |
| 1405 | static const char *extract_string_value(CBMExtractCtx *ctx, TSNode val_node) { |
| 1406 | const char *vk = ts_node_type(val_node); |
| 1407 | if (is_string_like(vk)) { |
| 1408 | char *text = cbm_node_text(ctx->arena, val_node, ctx->source); |
| 1409 | if (text && text[0]) { |
| 1410 | return strip_quotes(ctx->arena, text); |
| 1411 | } |
| 1412 | } else if (strcmp(vk, "identifier") == 0) { |
| 1413 | char *const_name = cbm_node_text(ctx->arena, val_node, ctx->source); |
| 1414 | if (const_name) { |
| 1415 | return lookup_string_constant(ctx, const_name); |
| 1416 | } |
| 1417 | } |
| 1418 | return NULL; |
| 1419 | } |
| 1420 | |
| 1421 | // Recover a queue/topic identity from a Go composite-literal input struct, e.g. |
| 1422 | // &sqs.SendMessageInput{QueueUrl: queueUrl, MessageBody: body} |
no test coverage detected