aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/grammar/expressions
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-28 09:12:42 +0100
committerAleksey Kladov <[email protected]>2018-08-28 09:12:42 +0100
commit2fa90e736b026ee979d9eb59178dc1f792228250 (patch)
treeadba3a569241a2030bf66e4e0b24ac5ffeaccbc3 /crates/libsyntax2/src/grammar/expressions
parent13110f48e948d7554500aefc336e72f96041386b (diff)
better recovery for exprs
Diffstat (limited to 'crates/libsyntax2/src/grammar/expressions')
-rw-r--r--crates/libsyntax2/src/grammar/expressions/atom.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/libsyntax2/src/grammar/expressions/atom.rs b/crates/libsyntax2/src/grammar/expressions/atom.rs
index ab4aa49d2..0769bb5a8 100644
--- a/crates/libsyntax2/src/grammar/expressions/atom.rs
+++ b/crates/libsyntax2/src/grammar/expressions/atom.rs
@@ -33,6 +33,9 @@ pub(super) const ATOM_EXPR_FIRST: TokenSet =
33 RETURN_KW, IDENT, SELF_KW, SUPER_KW, COLONCOLON, BREAK_KW, CONTINUE_KW, LIFETIME ], 33 RETURN_KW, IDENT, SELF_KW, SUPER_KW, COLONCOLON, BREAK_KW, CONTINUE_KW, LIFETIME ],
34 ]; 34 ];
35 35
36const EXPR_RECOVERY_SET: TokenSet =
37 token_set![LET_KW];
38
36pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<CompletedMarker> { 39pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<CompletedMarker> {
37 match literal(p) { 40 match literal(p) {
38 Some(m) => return Some(m), 41 Some(m) => return Some(m),
@@ -73,7 +76,7 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<CompletedMark
73 CONTINUE_KW => continue_expr(p), 76 CONTINUE_KW => continue_expr(p),
74 BREAK_KW => break_expr(p), 77 BREAK_KW => break_expr(p),
75 _ => { 78 _ => {
76 p.err_and_bump("expected expression"); 79 p.err_recover("expected expression", EXPR_RECOVERY_SET);
77 return None; 80 return None;
78 } 81 }
79 }; 82 };