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

Function line_comment_end

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

The end of a `//` comment starting at `i`: its newline (a `\` before it continues the comment).

(src: &str, mut i: usize)

Source from the content-addressed store, hash-verified

109
110/// The end of a `//` comment starting at `i`: its newline (a `\` before it continues the comment).
111fn line_comment_end(src: &str, mut i: usize) -> usize {
112 let s = src.as_bytes();
113 loop {
114 let Some(nl) = find(src, i, "\n") else { return s.len() };
115 let mut k = nl as isize - 1;
116 if k >= 0 && s[k as usize] == b'\r' {
117 k -= 1;
118 }
119 if k < 0 || s[k as usize] != b'\\' {
120 return nl;
121 }
122 i = nl + 1;
123 }
124}
125
126/// Past whitespace and comments from `i`.
127fn skip_blank(src: &str, mut i: usize) -> usize {

Callers 2

skip_blankFunction · 0.85
scanFunction · 0.85

Calls 2

lenMethod · 0.80
findFunction · 0.70

Tested by

no test coverage detected