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

Method expect

cranelift/isle/isle/src/parser.rs:62–71  ·  view source on GitHub ↗
(&mut self, f: F)

Source from the content-addressed store, hash-verified

60 }
61
62 fn expect<F: Fn(&Token) -> bool>(&mut self, f: F) -> Result<Token> {
63 if let Some(&(pos, ref peek)) = self.lexer.peek() {
64 if !f(peek) {
65 return Err(self.error(pos, format!("Unexpected token {peek:?}")));
66 }
67 Ok(self.lexer.next()?.unwrap().1)
68 } else {
69 Err(self.error(self.lexer.pos(), "Unexpected EOF".to_string()))
70 }
71 }
72
73 fn eat<F: Fn(&Token) -> bool>(&mut self, f: F) -> Result<Option<Token>> {
74 if let Some(&(_pos, ref peek)) = self.lexer.peek() {

Callers 15

stepFunction · 0.45
get_function_nameFunction · 0.45
callMethod · 0.45
resolve_global_valueMethod · 0.45
isle_input_filesMethod · 0.45
solve_constraintsFunction · 0.45
get_isle_filesFunction · 0.45
mainFunction · 0.45
visitMethod · 0.45
add_varMethod · 0.45
build_type_envFunction · 0.45
terms_in_cyclesFunction · 0.45

Calls 8

OkFunction · 0.85
fFunction · 0.50
peekMethod · 0.45
errorMethod · 0.45
unwrapMethod · 0.45
nextMethod · 0.45
posMethod · 0.45
to_stringMethod · 0.45

Tested by 2

get_isle_filesFunction · 0.36
build_type_envFunction · 0.36