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

Function jl_parse_identifier

src/cli/config_json_like.c:342–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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