aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/grammar/patterns.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-28 17:35:09 +0100
committerAleksey Kladov <[email protected]>2018-08-28 17:35:09 +0100
commitdea6ed73fac6f3f4daf38b1cb6df4c8fb68872b7 (patch)
tree7aff1c3b0fbb32f142fce778c7ac6b16fab65756 /crates/libsyntax2/src/grammar/patterns.rs
parent537ea620bb2a73a5e79872f414af23cf4bf03179 (diff)
better pattern recovery
Diffstat (limited to 'crates/libsyntax2/src/grammar/patterns.rs')
-rw-r--r--crates/libsyntax2/src/grammar/patterns.rs6
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
25const PAT_RECOVERY_SET: TokenSet =
26 token_set![LET_KW, IF_KW, WHILE_KW, LOOP_KW, MATCH_KW];
27
28
25fn atom_pat(p: &mut Parser) -> Option<CompletedMarker> { 29fn 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 };