work
This commit is contained in:
@@ -58,9 +58,10 @@ impl<'a> Cursor<'a> {
|
||||
self.peek().ok_or_else(CompilerMsg::unexpected_eof)
|
||||
}
|
||||
|
||||
pub fn expect(&mut self, token: Token) -> Result<Token, CompilerMsg> {
|
||||
pub fn expect(&mut self, token: impl Borrow<Token>) -> Result<Token, CompilerMsg> {
|
||||
let token = token.borrow();
|
||||
let next = self.expect_next()?;
|
||||
if next == token {
|
||||
if next == *token {
|
||||
Ok(next)
|
||||
} else {
|
||||
self.unexpected(&next, &format!("'{token}'"))
|
||||
|
||||
Reference in New Issue
Block a user