From 1bcd5ce9b0b7acf898722c774c444c92c8d97e65 Mon Sep 17 00:00:00 2001 From: Erin Date: Thu, 18 May 2023 23:49:54 +0200 Subject: [PATCH] Fixed BF code parsing --- ablescript/src/parser.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/ablescript/src/parser.rs b/ablescript/src/parser.rs index 4f2bf5a..c829bf9 100644 --- a/ablescript/src/parser.rs +++ b/ablescript/src/parser.rs @@ -462,16 +462,10 @@ impl<'source> Parser<'source> { let mut code: Vec = vec![]; loop { - match self.checked_next()? { - Token::Plus - | Token::Minus - | Token::Comma - | Token::LeftBracket - | Token::RightBracket - | Token::LessThan - | Token::GreaterThan => code.push(self.lexer.slice().as_bytes()[0]), - Token::RightCurly => break, - _ => (), + match self.lexer.next() { + Some(Ok(Token::RightCurly)) => break, + Some(_) => code.push(self.lexer.slice().as_bytes()[0]), + None => return Err(Error::unexpected_eoi(self.lexer.span().start)), } }