This commit is contained in:
2026-04-11 15:21:03 -04:00
parent 229b026573
commit 2582e8c87e
15 changed files with 301 additions and 199 deletions
+3 -2
View File
@@ -35,8 +35,8 @@ impl<'a> Cursor<'a> {
})
}
pub fn next_if(&mut self, token: Token) -> bool {
if self.peek().is_some_and(|t| *t == token) {
pub fn next_if(&mut self, token: &Token) -> bool {
if self.peek().is_some_and(|t| t == token) {
self.next();
true
} else {
@@ -54,6 +54,7 @@ impl<'a> Cursor<'a> {
pub fn expect_peek(&self) -> Result<&Token, CompilerMsg> {
self.peek().ok_or_else(CompilerMsg::unexpected_eof)
// Ok(self.peek().unwrap())
}
pub fn expect(&mut self, token: Token) -> Result<Token, CompilerMsg> {