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

Function sig_spell

internal/cbm/callable_sig.c:858–889  ·  view source on GitHub ↗

Qualified type paths keep their last segment; "->" becomes "=>"; any other * '.' or "::" (a receiver function type, a leading global scope) is dropped, * so the suffix contract holds whatever the grammar produced. */

Source from the content-addressed store, hash-verified

856 * '.' or "::" (a receiver function type, a leading global scope) is dropped,
857 * so the suffix contract holds whatever the grammar produced. */
858static size_t sig_spell(char *s, size_t n) {
859 size_t out = 0;
860 size_t i = 0;
861 while (i < n) {
862 size_t sep = 0;
863 if (s[i] == '.') {
864 sep = 1;
865 } else if (s[i] == ':' && i + 1 < n && s[i + 1] == ':') {
866 sep = 2;
867 }
868 if (sep) {
869 bool ident_before = out > 0 && sig_ident_char((unsigned char)s[out - 1]);
870 bool ident_after = i + sep < n && sig_ident_char((unsigned char)s[i + sep]);
871 if (ident_before && ident_after) {
872 while (out > 0 && sig_ident_char((unsigned char)s[out - 1])) {
873 out--;
874 }
875 }
876 i += sep;
877 continue;
878 }
879 if (s[i] == '-' && i + 1 < n && s[i + 1] == '>') {
880 s[out++] = '=';
881 s[out++] = '>';
882 i += 2;
883 continue;
884 }
885 s[out++] = s[i++];
886 }
887 s[out] = '\0';
888 return out;
889}
890
891static uint64_t sig_fnv64(const char *s, size_t n) {
892 uint64_t h = SIG_FNV_OFFSET;

Callers 1

cbm_callable_sig_modeFunction · 0.85

Calls 1

sig_ident_charFunction · 0.85

Tested by

no test coverage detected