This commit is contained in:
2026-04-17 18:51:12 -04:00
parent 2f91e454dd
commit b3f77076d4
20 changed files with 244 additions and 192 deletions
+3 -2
View File
@@ -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}'"))