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

Function subscript_span

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

904
905/// `\[[^\][]*\]` at `i` (the DISPATCH subscript form — no nested brackets):
906/// position after `]`, or None.
907fn subscript_span(s: &[u8], i: usize) -> Option<usize> {
908 if s.get(i) != Some(&b'[') {
909 return None;
910 }
911 let mut j = i + 1;
912 while j < s.len() && s[j] != b']' && s[j] != b'[' {
913 j += 1;
914 }
915 if j < s.len() && s[j] == b']' {
916 Some(j + 1)
917 } else {
918 None
919 }
920}
921
922/// `\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