diff --git a/crates/lang/src/parser.rs b/crates/lang/src/parser.rs index 5b968426..cca30599 100644 --- a/crates/lang/src/parser.rs +++ b/crates/lang/src/parser.rs @@ -382,9 +382,30 @@ pub fn expr_unit_parser() -> impl Parser impl Parser { + recursive(|_r| { + pattern_parser() + .then(just(Token::Colon).ignore_then(type_parser()).or_not()) + .then_ignore(just(Token::Equal)) + .then(expr_parser()) + .map_with_span( + |((pattern, annotation), value), span| expr::UntypedExpr::Assignment { + location: span, + value: Box::new(value), + pattern, + kind: ast::AssignmentKind::Let, + annotation, + }, + ) + }) +} + pub fn type_parser() -> impl Parser { recursive(|r| { choice((