ast: add continue expression
This commit is contained in:
@@ -120,6 +120,7 @@ fn from_prefix(token: &Token) -> PResult<(Ps, Prec)> {
|
||||
TKind::While => (Ps::Op(Op::While), Prec::Body),
|
||||
TKind::Break => (Ps::Op(Op::Break), Prec::Body),
|
||||
TKind::Return => (Ps::Op(Op::Return), Prec::Body),
|
||||
TKind::Continue => (Ps::Op(Op::Continue), Prec::Min),
|
||||
|
||||
TKind::LCurly => (Ps::Op(Op::Block), Prec::Min),
|
||||
TKind::RCurly => (Ps::End, Prec::Do),
|
||||
@@ -266,6 +267,7 @@ impl<'t> Parse<'t> for Expr {
|
||||
Some(value) => Expr::Op(Op::Group, vec![value]),
|
||||
None => Expr::Op(Op::Tuple, vec![]),
|
||||
},
|
||||
Ps::Op(Op::Continue) => p.consume().then(Expr::Op(Op::Continue, vec![])),
|
||||
Ps::Op(op @ (Op::If | Op::While)) => {
|
||||
p.consume();
|
||||
let exprs = vec![
|
||||
|
||||
Reference in New Issue
Block a user