This commit is contained in:
2026-04-17 00:09:00 -04:00
parent 83edad0cd8
commit e5ae506a84
11 changed files with 161 additions and 52 deletions
+4
View File
@@ -54,6 +54,10 @@ impl<'a> Cursor<'a> {
self.next().ok_or_else(CompilerMsg::unexpected_eof)
}
pub fn expect_peek(&self) -> Result<&Token, CompilerMsg> {
self.peek().ok_or_else(CompilerMsg::unexpected_eof)
}
pub fn expect(&mut self, token: Token) -> Result<Token, CompilerMsg> {
let next = self.expect_next()?;
if next == token {