diff options
Diffstat (limited to 'crates/libsyntax2/src/grammar')
-rw-r--r-- | crates/libsyntax2/src/grammar/patterns.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/libsyntax2/src/grammar/patterns.rs b/crates/libsyntax2/src/grammar/patterns.rs index 114964651..065570b99 100644 --- a/crates/libsyntax2/src/grammar/patterns.rs +++ b/crates/libsyntax2/src/grammar/patterns.rs | |||
@@ -22,6 +22,10 @@ pub(super) fn pattern(p: &mut Parser) { | |||
22 | } | 22 | } |
23 | } | 23 | } |
24 | 24 | ||
25 | const PAT_RECOVERY_SET: TokenSet = | ||
26 | token_set![LET_KW, IF_KW, WHILE_KW, LOOP_KW, MATCH_KW]; | ||
27 | |||
28 | |||
25 | fn atom_pat(p: &mut Parser) -> Option<CompletedMarker> { | 29 | fn atom_pat(p: &mut Parser) -> Option<CompletedMarker> { |
26 | let la0 = p.nth(0); | 30 | let la0 = p.nth(0); |
27 | let la1 = p.nth(1); | 31 | let la1 = p.nth(1); |
@@ -52,7 +56,7 @@ fn atom_pat(p: &mut Parser) -> Option<CompletedMarker> { | |||
52 | L_PAREN => tuple_pat(p), | 56 | L_PAREN => tuple_pat(p), |
53 | L_BRACK => slice_pat(p), | 57 | L_BRACK => slice_pat(p), |
54 | _ => { | 58 | _ => { |
55 | p.err_and_bump("expected pattern"); | 59 | p.err_recover("expected pattern", PAT_RECOVERY_SET); |
56 | return None; | 60 | return None; |
57 | } | 61 | } |
58 | }; | 62 | }; |