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

Function subscript_span

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

`\[[^\][]*\]` at `i` (the DISPATCH subscript form — no nested brackets): position after `]`, or None.

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

Source from the content-addressed store, hash-verified

876
877/// `\[[^\][]*\]` at `i` (the DISPATCH subscript form — no nested brackets):
878/// position after `]`, or None.
879fn subscript_span(s: &[u8], i: usize) -> Option<usize> {
880 if s.get(i) != Some(&b'[') {
881 return None;
882 }
883 let mut j = i + 1;
884 while j < s.len() && s[j] != b']' && s[j] != b'[' {
885 j += 1;
886 }
887 if j < s.len() && s[j] == b']' {
888 Some(j + 1)
889 } else {
890 None
891 }
892}
893
894/// `\s*(?:->|\.)\s*` at `i` → position after.

Callers 2

scan_dispatchFunction · 0.85
scan_array_dispatchFunction · 0.85

Calls 2

lenMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected