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

Function paren_group_end

codegraph-kernel/src/ccpp/brace_scopes.rs:176–196  ·  view source on GitHub ↗

Past the `(…)` group at `i` (strings inside skipped).

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

Source from the content-addressed store, hash-verified

174
175/// Past the `(…)` group at `i` (strings inside skipped).
176fn paren_group_end(s: &[u8], i: usize) -> Option<usize> {
177 let mut depth = 0usize;
178 let mut j = i;
179 while j < s.len() {
180 let c = s[j];
181 if c == b'"' || c == b'\'' {
182 j = quoted_end(s, j);
183 continue;
184 }
185 if c == b'(' {
186 depth += 1;
187 } else if c == b')' {
188 depth = depth.saturating_sub(1);
189 if depth == 0 {
190 return Some(j + 1);
191 }
192 }
193 j += 1;
194 }
195 None
196}
197
198/// namespaceHead: after the `namespace` keyword ending at `from`, the name as
199/// written and the offset of the body's `{`.

Callers 1

namespace_headFunction · 0.85

Calls 2

quoted_endFunction · 0.85
lenMethod · 0.80

Tested by

no test coverage detected