Skip to content

Commit

Permalink
Fix parsing of if-let exprs
Browse files Browse the repository at this point in the history
  • Loading branch information
parno committed Dec 24, 2023
1 parent df24706 commit 8ed3c90
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,7 @@ fn to_doc<'a>(
Rule::yield_expr => map_to_doc(ctx, arena, pair),
Rule::yeet_expr => map_to_doc(ctx, arena, pair),
Rule::let_expr => map_to_doc(ctx, arena, pair),
Rule::let_expr_no_struct => map_to_doc(ctx, arena, pair),
Rule::underscore_expr => map_to_doc(ctx, arena, pair).append(arena.text("_")),
Rule::box_expr => map_to_doc(ctx, arena, pair),

Expand Down
6 changes: 5 additions & 1 deletion src/verus.pest
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ expr_inner_no_struct = _{
| while_expr
| yield_expr
| yeet_expr
| let_expr
| let_expr_no_struct
| underscore_expr
| path_expr // Needs to be last, or it matches against keywords like "while"
}
Expand Down Expand Up @@ -1207,6 +1207,10 @@ let_expr = {
attr* ~ let_str ~ pat ~ eq_str ~ expr
}

let_expr_no_struct = {
attr* ~ let_str ~ pat ~ eq_str ~ expr_no_struct
}

underscore_expr = {
attr* ~ "_"
}
Expand Down

0 comments on commit 8ed3c90

Please sign in to comment.