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

Function array_table_body

codegraph-kernel/src/cfnptr.rs:638–683  ·  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

636/// ARRAY_TABLE_RE body after the anchor:
637/// `\s*(?:MOD\s+)*(\w+)\s+(\*\s*)?(\w+)\s*\[[^\]]*\]\s*=\s*\{`
638/// Token is `*`-prefixed when the star declarator is present.
639fn array_table_body(s: &[u8], p: usize) -> Option<(String, usize)> {
640 let i = skip_jsws(s, p);
641 let mods = modifier_positions(s, i);
642 for &pos in mods.iter().rev() {
643 if !is_word_at(s, pos) {
644 continue;
645 }
646 let te = word_end(s, pos);
647 let w = skip_jsws(s, te);
648 if w == te {
649 continue;
650 }
651 for with_star in [true, false] {
652 let q = if with_star {
653 if s.get(w) == Some(&b'*') {
654 skip_jsws(s, w + 1)
655 } else {
656 continue;
657 }
658 } else {
659 w
660 };
661 if !is_word_at(s, q) {
662 continue;
663 }
664 let ne = word_end(s, q);
665 let r = skip_jsws(s, ne);
666 let Some(r2) = bracket_span(s, r) else { continue };
667 let r3 = skip_jsws(s, r2);
668 if s.get(r3) != Some(&b'=') {
669 continue;
670 }
671 let r4 = skip_jsws(s, r3 + 1);
672 if s.get(r4) != Some(&b'{') {
673 continue;
674 }
675 let mut tok = String::new();
676 if with_star {
677 tok.push('*');
678 }
679 tok.push_str(&bytes_to_string(&s[pos..te]));
680 return Some((tok, r4 + 1));
681 }
682 }
683 None
684}
685
686/// 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