add EExpr error for unexpected comma

This commit is contained in:
Luke Boswell 2024-04-02 20:48:13 +11:00
parent 62cc19c64b
commit ca01913ab3
No known key found for this signature in database
GPG key ID: F6DB3C9DB47377B0
3 changed files with 30 additions and 1 deletions

View file

@ -1778,7 +1778,17 @@ fn parse_expr_end<'a>(
),
),
)
.parse(arena, state, min_indent)?;
.parse(arena, state, min_indent)
.map_err(|(progress, err)| {
// We were expecting the end of an expression, and parsed a comma
// therefore we are either on the LHS of backpassing or this is was
// in an invalid position.
if let EExpr::Pattern(EPattern::IndentEnd(_), pos) = err {
(progress, EExpr::UnexpectedComma(pos.sub(1)))
} else {
(progress, err)
}
})?;
expr_state.consume_spaces(arena);
let call = to_call(arena, expr_state.arguments, expr_state.expr);