| 197 | } |
| 198 | |
| 199 | fn array<'a, I>( |
| 200 | expr: impl Parser<'a, I, Expr, ParserError<'a>> + Clone + 'a, |
| 201 | ) -> impl Parser<'a, I, ExprKind, ParserError<'a>> + Clone + 'a |
| 202 | where |
| 203 | I: Input<'a, Token = lr::Token, Span = Span> + BorrowInput<'a>, |
| 204 | { |
| 205 | use chumsky::recovery::{skip_then_retry_until, via_parser}; |
| 206 | |
| 207 | sequence(expr) |
| 208 | .delimited_by( |
| 209 | ctrl('['), |
| 210 | ctrl(']') |
| 211 | .recover_with(via_parser(end())) |
| 212 | .recover_with(skip_then_retry_until( |
| 213 | any_ref().ignored(), |
| 214 | ctrl(']').ignored().or(ctrl(',').ignored()).or(end()), |
| 215 | )), |
| 216 | ) |
| 217 | .map(ExprKind::Array) |
| 218 | .labelled("array") |
| 219 | .boxed() |
| 220 | } |
| 221 | |
| 222 | fn interpolation<'a, I>() -> impl Parser<'a, I, ExprKind, ParserError<'a>> + Clone |
| 223 | where |