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

Function skip_blank

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

Past whitespace and comments from `i`.

(src: &str, mut i: usize)

Source from the content-addressed store, hash-verified

125
126/// Past whitespace and comments from `i`.
127fn skip_blank(src: &str, mut i: usize) -> usize {
128 let s = src.as_bytes();
129 while i < s.len() {
130 let c = s[i];
131 if is_blank(c) || c == b'\n' {
132 i += 1;
133 } else if c == b'/' && at(s, i + 1) == b'/' {
134 i = line_comment_end(src, i + 2);
135 } else if c == b'/' && at(s, i + 1) == b'*' {
136 i = find(src, i + 2, "*/").map_or(s.len(), |e| e + 2);
137 } else {
138 break;
139 }
140 }
141 i
142}
143
144/// The end of the identifier at `i`, if one starts there.
145fn word_end(s: &[u8], i: usize) -> Option<usize> {

Callers 1

namespace_headFunction · 0.85

Calls 5

is_blankFunction · 0.85
line_comment_endFunction · 0.85
lenMethod · 0.80
atFunction · 0.70
findFunction · 0.70

Tested by

no test coverage detected