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

Function qual_at

internal/cbm/doc_pdf.c:484–526  ·  view source on GitHub ↗

QUAL_RE: [A-Za-z_$][\w$]*(?:(?:\.|::|->|#)[A-Za-z_$][\w$]*)+(?:\(\))? */

Source from the content-addressed store, hash-verified

482
483/* QUAL_RE: [A-Za-z_$][\w$]*(?:(?:\.|::|->|#)[A-Za-z_$][\w$]*)+(?:\(\))? */
484static int qual_at(const uint32_t *t, int n, int p) {
485 if (p > 0) {
486 uint32_t b = t[p - 1];
487 if (pdf_u_word(b) || b == '.' || b == '$' || b == '@' || b == '/' || b == '-') {
488 return -1;
489 }
490 }
491 if (!ident_start(t[p])) {
492 return -1;
493 }
494 int q = p + 1;
495 while (q < n && ident_cont(t[q])) {
496 q++;
497 }
498 int groups = 0;
499 for (;;) {
500 int sep = 0;
501 if (q < n && t[q] == '.') {
502 sep = 1;
503 } else if (q + 1 < n && t[q] == ':' && t[q + 1] == ':') {
504 sep = 2;
505 } else if (q + 1 < n && t[q] == '-' && t[q + 1] == '>') {
506 sep = 2;
507 } else if (q < n && t[q] == '#') {
508 sep = 1;
509 }
510 if (!sep || q + sep >= n || !ident_start(t[q + sep])) {
511 break;
512 }
513 q += sep + 1;
514 while (q < n && ident_cont(t[q])) {
515 q++;
516 }
517 groups++;
518 }
519 if (!groups) {
520 return -1;
521 }
522 if (q + 1 < n && t[q] == '(' && t[q + 1] == ')') {
523 q += 2;
524 }
525 return q;
526}
527
528/* TOK_RE: [A-Za-z_$][\w$]* (whole identifier) */
529static int tok_at(const uint32_t *t, int n, int p) {

Callers 1

candidatesFunction · 0.85

Calls 3

pdf_u_wordFunction · 0.85
ident_startFunction · 0.85
ident_contFunction · 0.85

Tested by

no test coverage detected