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

Function array_table_body

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

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

Callers

nothing calls this directly

Calls 8

skip_jswsFunction · 0.85
modifier_positionsFunction · 0.85
is_word_atFunction · 0.85
bracket_spanFunction · 0.85
bytes_to_stringFunction · 0.85
pushMethod · 0.80
word_endFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected