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

Function quoted_end

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

Past the string or character literal whose quote is at `i` (it stops at a newline).

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

Source from the content-addressed store, hash-verified

155
156/// Past the string or character literal whose quote is at `i` (it stops at a newline).
157fn quoted_end(s: &[u8], i: usize) -> usize {
158 let quote = s[i];
159 let mut j = i + 1;
160 while j < s.len() {
161 let c = s[j];
162 if c == b'\\' {
163 j += if at(s, j + 1) == b'\r' && at(s, j + 2) == b'\n' { 3 } else { 2 };
164 } else if c == quote {
165 return j + 1;
166 } else if c == b'\n' {
167 return j;
168 } else {
169 j += 1;
170 }
171 }
172 s.len()
173}
174
175/// Past the `(…)` group at `i` (strings inside skipped).
176fn paren_group_end(s: &[u8], i: usize) -> Option<usize> {

Callers 2

paren_group_endFunction · 0.85
scanFunction · 0.85

Calls 2

lenMethod · 0.80
atFunction · 0.70

Tested by

no test coverage detected