forked from AbleScript/ablescript
Nest the loop inside a match arm
This commit is contained in:
parent
0d497bccdd
commit
603a244b78
|
@ -237,10 +237,9 @@ impl<'source> Parser<'source> {
|
|||
let mut buf = None;
|
||||
|
||||
match self.checked_next()? {
|
||||
Token::RightBracket => return Ok(ExprKind::Cart(cart)),
|
||||
t => buf = Some(self.parse_expr(t, &mut buf)?),
|
||||
}
|
||||
|
||||
Token::RightBracket => (),
|
||||
t => {
|
||||
buf = Some(self.parse_expr(t, &mut buf)?);
|
||||
'cart: loop {
|
||||
let value = loop {
|
||||
match self.checked_next()? {
|
||||
|
@ -257,8 +256,9 @@ impl<'source> Parser<'source> {
|
|||
Token::RightBracket => {
|
||||
cart.push((
|
||||
value,
|
||||
buf.take()
|
||||
.ok_or_else(|| Error::unexpected_eof(self.lexer.span().start))?,
|
||||
buf.take().ok_or_else(|| {
|
||||
Error::unexpected_eof(self.lexer.span().start)
|
||||
})?,
|
||||
));
|
||||
|
||||
break 'cart;
|
||||
|
@ -271,6 +271,8 @@ impl<'source> Parser<'source> {
|
|||
|
||||
cart.push((value, key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(ExprKind::Cart(cart))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue