MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / next_ch

Method next_ch

cranelift/reader/src/lexer.rs:159–174  ·  view source on GitHub ↗

Advance to the next character. Return the next lookahead character, or None when the end is encountered. Always update cur_ch to reflect

(&mut self)

Source from the content-addressed store, hash-verified

157 // Return the next lookahead character, or None when the end is encountered.
158 // Always update cur_ch to reflect
159 fn next_ch(&mut self) -> Option<char> {
160 if self.lookahead == Some('\n') {
161 self.line_number += 1;
162 }
163 match self.chars.next() {
164 Some((idx, ch)) => {
165 self.pos = idx;
166 self.lookahead = Some(ch);
167 }
168 None => {
169 self.pos = self.source.len();
170 self.lookahead = None;
171 }
172 }
173 self.lookahead
174 }
175
176 // Get the location corresponding to `lookahead`.
177 fn loc(&self) -> Location {

Callers 11

newMethod · 0.80
scan_charMethod · 0.80
scan_charsMethod · 0.80
rest_of_lineMethod · 0.80
scan_numberMethod · 0.80
scan_wordMethod · 0.80
scan_nameMethod · 0.80
scan_stringMethod · 0.80
scan_hex_sequenceMethod · 0.80
scan_srclocMethod · 0.80
nextMethod · 0.80

Calls 2

nextMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected