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:729–757  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

727}
728
729static int agent_json_scan_string(agent_json_scanner_t *scanner, size_t *start_out,
730 size_t *end_out) {
731 if (scanner->position >= scanner->length ||
732 (scanner->data[scanner->position] != '"' && scanner->data[scanner->position] != '\'')) {
733 return -1;
734 }
735 char quote = scanner->data[scanner->position++];
736 size_t start = scanner->position;
737 bool escaped = false;
738 while (scanner->position < scanner->length) {
739 char current = scanner->data[scanner->position++];
740 if (escaped) {
741 escaped = false;
742 } else if (current == '\\') {
743 escaped = true;
744 } else if (current == quote) {
745 if (start_out) {
746 *start_out = start;
747 }
748 if (end_out) {
749 *end_out = scanner->position - 1U;
750 }
751 return 0;
752 } else if ((unsigned char)current < 0x20U) {
753 return -1;
754 }
755 }
756 return -1;
757}
758
759static int agent_json_scan_value(agent_json_scanner_t *scanner, unsigned depth);
760

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