ignore comments in repl

This commit is contained in:
Kiryl Dziamura 2024-05-22 00:51:38 +02:00
parent 45a7e448dd
commit fb108af73e
No known key found for this signature in database
GPG key ID: FB539501A4561ACF
2 changed files with 10 additions and 4 deletions

View file

@ -2346,10 +2346,13 @@ fn parse_expr_end<'a>(
}
pub fn loc_expr<'a>(accept_multi_backpassing: bool) -> impl Parser<'a, Loc<Expr<'a>>, EExpr<'a>> {
expr_start(ExprParseOptions {
accept_multi_backpassing,
check_for_arrow: true,
})
space0_before_e(
expr_start(ExprParseOptions {
accept_multi_backpassing,
check_for_arrow: true,
}),
EExpr::IndentEnd,
)
}
pub fn merge_spaces<'a>(

View file

@ -275,6 +275,9 @@ pub fn parse_src<'a>(arena: &'a Bump, line: &'a str) -> ParseOutcome<'a> {
match roc_parse::expr::loc_expr(true).parse(arena, State::new(src_bytes), 0) {
Ok((_, loc_expr, _)) => ParseOutcome::Expr(loc_expr.value),
Err((roc_parse::parser::Progress::MadeProgress, EExpr::Start(_))) => {
ParseOutcome::Empty
}
// Special case some syntax errors to allow for multi-line inputs
Err((_, EExpr::Closure(EClosure::Body(_, _), _)))
| Err((_, EExpr::When(EWhen::Pattern(EPattern::Start(_), _), _)))