forked from AbleScript/ablescript
Fixed BF code parsing
This commit is contained in:
parent
89c4fe68d2
commit
1bcd5ce9b0
|
@ -462,16 +462,10 @@ impl<'source> Parser<'source> {
|
|||
|
||||
let mut code: Vec<u8> = 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)),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue