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

Function resolve_wolfram_func_name

internal/cbm/extract_defs.c:481–497  ·  view source on GitHub ↗

Wolfram: resolve set/set_delayed name from LHS apply→symbol. The defined symbol's head can be a user_symbol (lowercase user names) OR a builtin_symbol (capitalized names like Square/Cube, which the grammar tags as builtin even when user-defined). For a bare `Name = value` (set_top with no apply), the LHS is the symbol itself. Accept all three forms so multiple defs in one file each resolve to a di

Source from the content-addressed store, hash-verified

479// apply), the LHS is the symbol itself. Accept all three forms so multiple
480// defs in one file each resolve to a distinct name instead of collapsing.
481static TSNode resolve_wolfram_func_name(TSNode node) {
482 if (ts_node_named_child_count(node) > 0) {
483 TSNode lhs = ts_node_named_child(node, 0);
484 const char *lk = ts_node_type(lhs);
485 if (strcmp(lk, "apply") == 0 && ts_node_named_child_count(lhs) > 0) {
486 TSNode head = ts_node_named_child(lhs, 0);
487 const char *hk = ts_node_type(head);
488 if (strcmp(hk, "user_symbol") == 0 || strcmp(hk, "builtin_symbol") == 0) {
489 return head;
490 }
491 } else if (strcmp(lk, "user_symbol") == 0 || strcmp(lk, "builtin_symbol") == 0) {
492 return lhs;
493 }
494 }
495 TSNode null_node = {0};
496 return null_node;
497}
498
499// Resolve function name for FP/scientific languages.
500static TSNode resolve_func_name_fp(TSNode node, CBMLanguage lang, const char *kind, TSNode name) {

Callers 1

resolve_func_name_fpFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected