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

Method token

cranelift/reader/src/parser.rs:482–505  ·  view source on GitHub ↗

Get the current lookahead token, after making sure there is one.

(&mut self)

Source from the content-addressed store, hash-verified

480
481 // Get the current lookahead token, after making sure there is one.
482 fn token(&mut self) -> Option<Token<'a>> {
483 while self.lookahead.is_none() {
484 match self.lex.next() {
485 Some(Ok(LocatedToken { token, location })) => {
486 match token {
487 Token::Comment(text) => {
488 if self.gathering_comments {
489 self.gathered_comments.push(text);
490 }
491 }
492 _ => self.lookahead = Some(token),
493 }
494 self.loc = location;
495 }
496 Some(Err(LocatedError { error, location })) => {
497 self.lex_error = Some(error);
498 self.loc = location;
499 break;
500 }
501 None => break,
502 }
503 }
504 self.lookahead
505 }
506
507 // Enable gathering of all comments encountered.
508 fn start_gathering_comments(&mut self) {

Callers 15

parse_testFunction · 0.80
parse_run_commandFunction · 0.80
match_tokenMethod · 0.80
optionalMethod · 0.80
match_identifierMethod · 0.80
match_typeMethod · 0.80
match_ssMethod · 0.80
match_dssMethod · 0.80
match_dtMethod · 0.80
match_gvMethod · 0.80
match_fnMethod · 0.80
match_sigMethod · 0.80

Calls 3

is_noneMethod · 0.45
nextMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected