MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / array_table_body

Function array_table_body

codegraph-kernel/src/cfnptr.rs:627–672  ·  view source on GitHub ↗

ARRAY_TABLE_RE body after the anchor: `\s*(?:MOD\s+)*(\w+)\s+(\*\s*)?(\w+)\s*\[[^\]]*\]\s*=\s*\{` Token is `*`-prefixed when the star declarator is present.

(s: &[u8], p: usize)

Source from the content-addressed store, hash-verified

625/// ARRAY_TABLE_RE body after the anchor:
626/// `\s*(?:MOD\s+)*(\w+)\s+(\*\s*)?(\w+)\s*\[[^\]]*\]\s*=\s*\{`
627/// Token is `*`-prefixed when the star declarator is present.
628fn array_table_body(s: &[u8], p: usize) -> Option<(String, usize)> {
629 let i = skip_jsws(s, p);
630 let mods = modifier_positions(s, i);
631 for &pos in mods.iter().rev() {
632 if !is_word_at(s, pos) {
633 continue;
634 }
635 let te = word_end(s, pos);
636 let w = skip_jsws(s, te);
637 if w == te {
638 continue;
639 }
640 for with_star in [true, false] {
641 let q = if with_star {
642 if s.get(w) == Some(&b'*') {
643 skip_jsws(s, w + 1)
644 } else {
645 continue;
646 }
647 } else {
648 w
649 };
650 if !is_word_at(s, q) {
651 continue;
652 }
653 let ne = word_end(s, q);
654 let r = skip_jsws(s, ne);
655 let Some(r2) = bracket_span(s, r) else { continue };
656 let r3 = skip_jsws(s, r2);
657 if s.get(r3) != Some(&b'=') {
658 continue;
659 }
660 let r4 = skip_jsws(s, r3 + 1);
661 if s.get(r4) != Some(&b'{') {
662 continue;
663 }
664 let mut tok = String::new();
665 if with_star {
666 tok.push('*');
667 }
668 tok.push_str(&bytes_to_string(&s[pos..te]));
669 return Some((tok, r4 + 1));
670 }
671 }
672 None
673}
674
675/// OBJ_ALIAS_RE over the continuation-joined text:

Callers

nothing calls this directly

Calls 7

skip_jswsFunction · 0.85
modifier_positionsFunction · 0.85
is_word_atFunction · 0.85
word_endFunction · 0.85
bracket_spanFunction · 0.85
bytes_to_stringFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected