Fix constant definition parser.

Wouldn't allow a proper sequence of results. Now it does.
This commit is contained in:
KtorZ 2024-08-17 15:53:48 +02:00
parent a909e9eb0a
commit 71f90ad49f
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
1 changed files with 4 additions and 2 deletions

View File

@ -14,8 +14,10 @@ pub fn parser() -> impl Parser<Token, ast::UntypedDefinition, Error = ParseError
.or_not(), .or_not(),
) )
.then_ignore(just(Token::Equal)) .then_ignore(just(Token::Equal))
.then(recursive(|expression| { .then(recursive(|sequence| {
recursive(|sequence| pure_expression(sequence, expression)) recursive(|expression| pure_expression(sequence.clone(), expression))
.then(sequence.repeated())
.foldl(|current, next| current.append_in_sequence(next))
})) }))
.map_with_span(|(((public, name), annotation), value), span| { .map_with_span(|(((public, name), annotation), value), span| {
ast::UntypedDefinition::ModuleConstant(ast::ModuleConstant { ast::UntypedDefinition::ModuleConstant(ast::ModuleConstant {