mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 15:51:12 +00:00
Merge pull request #6767 from wontem/comments-in-repl
Ignore comments in repl
This commit is contained in:
commit
33075285b7
2 changed files with 10 additions and 4 deletions
|
@ -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>> {
|
pub fn loc_expr<'a>(accept_multi_backpassing: bool) -> impl Parser<'a, Loc<Expr<'a>>, EExpr<'a>> {
|
||||||
expr_start(ExprParseOptions {
|
space0_before_e(
|
||||||
accept_multi_backpassing,
|
expr_start(ExprParseOptions {
|
||||||
check_for_arrow: true,
|
accept_multi_backpassing,
|
||||||
})
|
check_for_arrow: true,
|
||||||
|
}),
|
||||||
|
EExpr::IndentEnd,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn merge_spaces<'a>(
|
pub fn merge_spaces<'a>(
|
||||||
|
|
|
@ -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) {
|
match roc_parse::expr::loc_expr(true).parse(arena, State::new(src_bytes), 0) {
|
||||||
Ok((_, loc_expr, _)) => ParseOutcome::Expr(loc_expr.value),
|
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
|
// Special case some syntax errors to allow for multi-line inputs
|
||||||
Err((_, EExpr::Closure(EClosure::Body(_, _), _)))
|
Err((_, EExpr::Closure(EClosure::Body(_, _), _)))
|
||||||
| Err((_, EExpr::When(EWhen::Pattern(EPattern::Start(_), _), _)))
|
| Err((_, EExpr::When(EWhen::Pattern(EPattern::Start(_), _), _)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue