mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
fix parsing issue
This commit is contained in:
parent
6db4bd6ed4
commit
a6a4750501
2 changed files with 10 additions and 4 deletions
|
@ -53,14 +53,20 @@ pub fn desugar_def<'a>(arena: &'a Bump, def: &'a Def<'a>) -> Def<'a> {
|
||||||
comment,
|
comment,
|
||||||
body_pattern,
|
body_pattern,
|
||||||
body_expr,
|
body_expr,
|
||||||
} => AnnotatedBody {
|
}
|
||||||
|
| Nested(AnnotatedBody {
|
||||||
|
ann_pattern,
|
||||||
|
ann_type,
|
||||||
|
comment,
|
||||||
|
body_pattern,
|
||||||
|
body_expr,
|
||||||
|
}) => AnnotatedBody {
|
||||||
ann_pattern: ann_pattern,
|
ann_pattern: ann_pattern,
|
||||||
ann_type: ann_type,
|
ann_type: ann_type,
|
||||||
comment: *comment,
|
comment: *comment,
|
||||||
body_pattern: *body_pattern,
|
body_pattern: *body_pattern,
|
||||||
body_expr: desugar_expr(arena, body_expr),
|
body_expr: desugar_expr(arena, body_expr),
|
||||||
},
|
},
|
||||||
Nested(ann_body @ AnnotatedBody { .. }) => Nested(ann_body),
|
|
||||||
Nested(NotYetImplemented(s)) => todo!("{}", s),
|
Nested(NotYetImplemented(s)) => todo!("{}", s),
|
||||||
NotYetImplemented(s) => todo!("{}", s),
|
NotYetImplemented(s) => todo!("{}", s),
|
||||||
}
|
}
|
||||||
|
|
|
@ -567,7 +567,7 @@ type Body<'a> = (Located<Pattern<'a>>, Located<Expr<'a>>);
|
||||||
fn body<'a>(min_indent: u16) -> impl Parser<'a, Body<'a>> {
|
fn body<'a>(min_indent: u16) -> impl Parser<'a, Body<'a>> {
|
||||||
let indented_more = min_indent + 1;
|
let indented_more = min_indent + 1;
|
||||||
and!(
|
and!(
|
||||||
pattern(min_indent),
|
skip_first!(space0(min_indent), pattern(min_indent)),
|
||||||
skip_first!(
|
skip_first!(
|
||||||
equals_for_def(),
|
equals_for_def(),
|
||||||
// Spaces after the '=' (at a normal indentation level) and then the expr.
|
// Spaces after the '=' (at a normal indentation level) and then the expr.
|
||||||
|
@ -817,7 +817,7 @@ fn parse_def_signature<'a>(
|
||||||
type_annotation::located(indented_more),
|
type_annotation::located(indented_more),
|
||||||
// The first annotation may be followed by a body
|
// The first annotation may be followed by a body
|
||||||
// leading to an AnnotatedBody in this case
|
// leading to an AnnotatedBody in this case
|
||||||
optional(and!(spaces_then_comment_or_newline(), body(min_indent)))
|
optional(and!(spaces_then_comment_or_newline(), body(indented_more)))
|
||||||
),
|
),
|
||||||
and!(
|
and!(
|
||||||
// Optionally parse additional defs.
|
// Optionally parse additional defs.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue