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

Function agent_json_scan_string

src/cli/agent_clients.c:744–772  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

742}
743
744static int agent_json_scan_string(agent_json_scanner_t *scanner, size_t *start_out,
745 size_t *end_out) {
746 if (scanner->position >= scanner->length ||
747 (scanner->data[scanner->position] != '"' && scanner->data[scanner->position] != '\'')) {
748 return -1;
749 }
750 char quote = scanner->data[scanner->position++];
751 size_t start = scanner->position;
752 bool escaped = false;
753 while (scanner->position < scanner->length) {
754 char current = scanner->data[scanner->position++];
755 if (escaped) {
756 escaped = false;
757 } else if (current == '\\') {
758 escaped = true;
759 } else if (current == quote) {
760 if (start_out) {
761 *start_out = start;
762 }
763 if (end_out) {
764 *end_out = scanner->position - 1U;
765 }
766 return 0;
767 } else if ((unsigned char)current < 0x20U) {
768 return -1;
769 }
770 }
771 return -1;
772}
773
774static int agent_json_scan_value(agent_json_scanner_t *scanner, unsigned depth);
775

Callers 3

agent_json_scan_objectFunction · 0.85
agent_json_scan_valueFunction · 0.85
agent_json_find_memberFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected