mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
move when and if into expression
This commit is contained in:
parent
1b750149c0
commit
7f7593f63e
2 changed files with 9 additions and 6 deletions
|
@ -322,12 +322,9 @@ fn loc_parse_expr_body_without_operators_help<'a>(
|
|||
loc_expr_in_parens_etc_help(min_indent),
|
||||
loc!(specialize(EExpr::Str, string_literal_help())),
|
||||
loc!(specialize(EExpr::Number, number_literal_help())),
|
||||
loc!(specialize(EExpr::Lambda, closure_help(min_indent))),
|
||||
loc!(record_literal_help(min_indent)),
|
||||
loc!(specialize(EExpr::List, list_literal_help(min_indent))),
|
||||
loc!(unary_op_help(min_indent)),
|
||||
loc!(specialize(EExpr::When, when::expr_help(min_indent))),
|
||||
loc!(specialize(EExpr::If, if_expr_help(min_indent))),
|
||||
loc!(ident_etc_help(min_indent)),
|
||||
fail_expr_start_e()
|
||||
)
|
||||
|
@ -436,8 +433,14 @@ fn parse_expr_help<'a>(
|
|||
arena: &'a Bump,
|
||||
state: State<'a>,
|
||||
) -> ParseResult<'a, Expr<'a>, EExpr<'a>> {
|
||||
let (_, loc_expr1, state) =
|
||||
loc_parse_expr_body_without_operators_help(min_indent, arena, state)?;
|
||||
let (_, loc_expr1, state) = one_of![
|
||||
|arena, state| loc_parse_expr_body_without_operators_help(min_indent, arena, state),
|
||||
loc!(specialize(EExpr::If, if_expr_help(min_indent))),
|
||||
loc!(specialize(EExpr::When, when::expr_help(min_indent))),
|
||||
loc!(specialize(EExpr::Lambda, closure_help(min_indent))),
|
||||
fail_expr_start_e()
|
||||
]
|
||||
.parse(arena, state)?;
|
||||
|
||||
let initial = state.clone();
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@ fn to_expr_report<'a>(
|
|||
alloc.concat(vec![
|
||||
alloc.reflow("The has-type operator "),
|
||||
alloc.parser_suggestion(":"),
|
||||
alloc.reflow(" can only occur in a definition's type signature, like "),
|
||||
alloc.reflow(" can only occur in a definition's type signature, like"),
|
||||
]),
|
||||
alloc
|
||||
.vcat(vec![
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue