Extract string value from a node (literal or constant reference).
| 1903 | |
| 1904 | // Extract string value from a node (literal or constant reference). |
| 1905 | static const char *extract_string_value(CBMExtractCtx *ctx, TSNode val_node) { |
| 1906 | const char *vk = ts_node_type(val_node); |
| 1907 | if (strcmp(vk, "template_string") == 0) { |
| 1908 | return cbm_template_string_text(ctx->arena, val_node, ctx->source); |
| 1909 | } |
| 1910 | if (is_string_like(vk)) { |
| 1911 | char *text = cbm_node_text(ctx->arena, val_node, ctx->source); |
| 1912 | if (text && text[0]) { |
| 1913 | return strip_quotes(ctx->arena, text); |
| 1914 | } |
| 1915 | } else if (strcmp(vk, "identifier") == 0) { |
| 1916 | char *const_name = cbm_node_text(ctx->arena, val_node, ctx->source); |
| 1917 | if (const_name) { |
| 1918 | return lookup_string_constant(ctx, const_name); |
| 1919 | } |
| 1920 | } |
| 1921 | return NULL; |
| 1922 | } |
| 1923 | |
| 1924 | // Recover a queue/topic identity from a Go composite-literal input struct, e.g. |
| 1925 | // &sqs.SendMessageInput{QueueUrl: queueUrl, MessageBody: body} |
no test coverage detected