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

Function jl_parse_identifier

src/cli/config_json_like.c:341–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339}
340
341static int jl_parse_identifier(jl_parser_t *parser, size_t *start_out, size_t *end_out) {
342 size_t start = parser->pos;
343 bool first = true;
344 while (parser->pos < parser->length) {
345 unsigned char c = (unsigned char)parser->text[parser->pos];
346 bool accepted = first ? jl_is_identifier_start(c) : jl_is_identifier_continue(c);
347 if (accepted) {
348 parser->pos++;
349 first = false;
350 continue;
351 }
352 if (c == '\\' && parser->length - parser->pos >= 6U &&
353 parser->text[parser->pos + 1U] == 'u') {
354 bool valid_escape = true;
355 for (size_t i = 0; i < 4U; i++) {
356 if (!jl_is_hex((unsigned char)parser->text[parser->pos + 2U + i])) {
357 valid_escape = false;
358 break;
359 }
360 }
361 if (valid_escape) {
362 uint32_t codepoint = jl_decode_hex4(parser->text + parser->pos + 2U);
363 valid_escape = codepoint >= 0x80U ||
364 (first ? jl_is_identifier_start((unsigned char)codepoint)
365 : jl_is_identifier_continue((unsigned char)codepoint));
366 if (codepoint >= 0xD800U && codepoint <= 0xDFFFU) {
367 valid_escape = false;
368 }
369 }
370 if (valid_escape) {
371 parser->pos += 6U;
372 first = false;
373 continue;
374 }
375 }
376 break;
377 }
378 if (first) {
379 return -1;
380 }
381 if (start_out) {
382 *start_out = start;
383 }
384 if (end_out) {
385 *end_out = parser->pos;
386 }
387 return 0;
388}
389
390static int jl_parse_key(jl_parser_t *parser, size_t *start_out, size_t *end_out) {
391 if (parser->pos >= parser->length) {

Callers 1

jl_parse_keyFunction · 0.85

Calls 4

jl_is_identifier_startFunction · 0.85
jl_is_hexFunction · 0.85
jl_decode_hex4Function · 0.85

Tested by

no test coverage detected