mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
Treat crash keyword uniformly
This commit is contained in:
parent
9b13b19d08
commit
0acd59b4d6
4 changed files with 8 additions and 2 deletions
|
@ -236,6 +236,7 @@ fn loc_term<'a>(options: ExprParseOptions) -> impl Parser<'a, Loc<Expr<'a>>, EEx
|
||||||
positive_number_literal_help()
|
positive_number_literal_help()
|
||||||
)),
|
)),
|
||||||
loc(specialize_err(EExpr::Closure, closure_help(options))),
|
loc(specialize_err(EExpr::Closure, closure_help(options))),
|
||||||
|
loc(crash_kw()),
|
||||||
loc(specialize_err(EExpr::Dbg, dbg_kw())),
|
loc(specialize_err(EExpr::Dbg, dbg_kw())),
|
||||||
loc(try_kw()),
|
loc(try_kw()),
|
||||||
loc(record_literal_help()),
|
loc(record_literal_help()),
|
||||||
|
@ -284,12 +285,13 @@ fn underscore_expression<'a>() -> impl Parser<'a, Expr<'a>, EExpr<'a>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn crash_kw<'a>() -> impl Parser<'a, Expr<'a>, EExpr<'a>> {
|
fn crash_kw<'a>() -> impl Parser<'a, Expr<'a>, EExpr<'a>> {
|
||||||
move |arena: &'a Bump, state: State<'a>, min_indent: u32| {
|
(move |arena: &'a Bump, state: State<'a>, min_indent: u32| {
|
||||||
let (_, _, next_state) = crate::parser::keyword(crate::keyword::CRASH, EExpr::Crash)
|
let (_, _, next_state) = crate::parser::keyword(crate::keyword::CRASH, EExpr::Crash)
|
||||||
.parse(arena, state, min_indent)?;
|
.parse(arena, state, min_indent)?;
|
||||||
|
|
||||||
Ok((MadeProgress, Expr::Crash, next_state))
|
Ok((MadeProgress, Expr::Crash, next_state))
|
||||||
}
|
})
|
||||||
|
.trace("crash_kw")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn loc_possibly_negative_or_negated_term<'a>(
|
fn loc_possibly_negative_or_negated_term<'a>(
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Expr(BadExprEnd(@12), @0)
|
|
@ -0,0 +1,2 @@
|
||||||
|
h-
|
||||||
|
-o -crash!
|
|
@ -247,6 +247,7 @@ mod test_snapshots {
|
||||||
fail/return_in_pat.expr,
|
fail/return_in_pat.expr,
|
||||||
fail/single_no_end.expr,
|
fail/single_no_end.expr,
|
||||||
fail/str_over_large_unicode_escape.expr,
|
fail/str_over_large_unicode_escape.expr,
|
||||||
|
fail/sub_minus_o_apply_minus_crash_bang.expr,
|
||||||
fail/tab_crash.header,
|
fail/tab_crash.header,
|
||||||
fail/tag_union_end.expr,
|
fail/tag_union_end.expr,
|
||||||
fail/tag_union_lowercase_tag_name.expr,
|
fail/tag_union_lowercase_tag_name.expr,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue