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

Function spawn_collection_prefix

internal/cbm/spawn_patterns.c:576–589  ·  view source on GitHub ↗

What may stand before a collection's bracket: nothing, Zig's `&.` / `.`, * Java's `new String[]`, or a collection constructor. A name before `[` is a * subscript (`record["argv"]`) and any other call's arguments are not the * command (`os.path.join("bin", tool)`). */

Source from the content-addressed store, hash-verified

574 * subscript (`record["argv"]`) and any other call's arguments are not the
575 * command (`os.path.join("bin", tool)`). */
576static bool spawn_collection_prefix(const char *p, size_t len) {
577 static const char *const ctors[] = {
578 "listOf", "arrayOf", "mutableListOf", "List.of", "Arrays.asList", "vec!", "c", "Cmd", NULL};
579 if (len == 0 || (len <= 2 && strspn(p, "&.") == len) ||
580 (len > 2 && strncmp(p + len - 2, "[]", 2) == 0 && strncmp(p, "new ", 4) == 0)) {
581 return true;
582 }
583 for (int i = 0; ctors[i]; i++) {
584 if (strlen(ctors[i]) == len && strncmp(p, ctors[i], len) == 0) {
585 return true;
586 }
587 }
588 return false;
589}
590
591/* The first element of a collection written at `p` ([..], (..), {..},
592 * listOf(..), &.{..}), copied into `out`. False when `p` is no collection. */

Callers 1

spawn_first_elementFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected