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

Function subscript_span

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

894
895/// `\[[^\][]*\]` at `i` (the DISPATCH subscript form — no nested brackets):
896/// position after `]`, or None.
897fn subscript_span(s: &[u8], i: usize) -> Option<usize> {
898 if s.get(i) != Some(&b'[') {
899 return None;
900 }
901 let mut j = i + 1;
902 while j < s.len() && s[j] != b']' && s[j] != b'[' {
903 j += 1;
904 }
905 if j < s.len() && s[j] == b']' {
906 Some(j + 1)
907 } else {
908 None
909 }
910}
911
912/// `\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