MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / extract_string_value

Function extract_string_value

internal/cbm/extract_calls.c:1905–1922  ·  view source on GitHub ↗

Extract string value from a node (literal or constant reference).

Source from the content-addressed store, hash-verified

1903
1904// Extract string value from a node (literal or constant reference).
1905static 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}

Callers 2

extract_keyword_urlFunction · 0.85

Calls 5

cbm_template_string_textFunction · 0.85
is_string_likeFunction · 0.85
cbm_node_textFunction · 0.85
lookup_string_constantFunction · 0.85
strip_quotesFunction · 0.70

Tested by

no test coverage detected