mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
Parse Expr::Suffixed
This commit is contained in:
parent
88042c2578
commit
9bc0ab79af
2 changed files with 15 additions and 0 deletions
|
@ -267,6 +267,9 @@ pub enum Expr<'a> {
|
|||
// Collection Literals
|
||||
List(Collection<'a, &'a Loc<Expr<'a>>>),
|
||||
|
||||
/// An expression followed by `!``
|
||||
Suffixed(&'a Expr<'a>),
|
||||
|
||||
RecordUpdate {
|
||||
update: &'a Loc<Expr<'a>>,
|
||||
fields: Collection<'a, Loc<AssignedField<'a, Expr<'a>>>>,
|
||||
|
|
|
@ -1817,6 +1817,18 @@ fn parse_expr_end<'a>(
|
|||
}
|
||||
}
|
||||
}
|
||||
.map(|(progress, expr, state)| {
|
||||
// If the next thing after the expression is a `!`, then it's Suffixed
|
||||
if state.bytes().starts_with(b"!") {
|
||||
(
|
||||
progress,
|
||||
Expr::Suffixed(arena.alloc(expr)),
|
||||
state.advance(1),
|
||||
)
|
||||
} else {
|
||||
(progress, expr, state)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn loc_expr<'a>(accept_multi_backpassing: bool) -> impl Parser<'a, Loc<Expr<'a>>, EExpr<'a>> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue