diff --git a/crates/ra_syntax/src/grammar/expressions.rs b/crates/ra_syntax/src/grammar/expressions.rs index 79de0add0b2..4f8c46ab3c2 100644 --- a/crates/ra_syntax/src/grammar/expressions.rs +++ b/crates/ra_syntax/src/grammar/expressions.rs @@ -5,7 +5,6 @@ pub(super) use self::atom::{literal, LITERAL_FIRST}; use super::*; const EXPR_FIRST: TokenSet = LHS_FIRST; -const EXPR_FIRST_NO_BLOCK: TokenSet = LHS_FIRST_NO_BLOCK; pub(super) fn expr(p: &mut Parser) -> BlockLike { let r = Restrictions { @@ -210,10 +209,6 @@ const LHS_FIRST: TokenSet = token_set_union![ token_set![AMP, STAR, EXCL, DOTDOT, MINUS], atom::ATOM_EXPR_FIRST, ]; -const LHS_FIRST_NO_BLOCK: TokenSet = token_set_union![ - token_set![AMP, STAR, EXCL, DOTDOT, MINUS], - atom::ATOM_EXPR_FIRST_NO_BLOCK, -]; fn lhs(p: &mut Parser, r: Restrictions) -> Option<(CompletedMarker, BlockLike)> { let m; diff --git a/crates/ra_syntax/src/grammar/expressions/atom.rs b/crates/ra_syntax/src/grammar/expressions/atom.rs index fcc0a4490ce..3b5749318d2 100644 --- a/crates/ra_syntax/src/grammar/expressions/atom.rs +++ b/crates/ra_syntax/src/grammar/expressions/atom.rs @@ -36,10 +36,11 @@ pub(crate) fn literal(p: &mut Parser) -> Option { } // E.g. for after the break in `if break {}`, this should not match -pub(super) const ATOM_EXPR_FIRST_NO_BLOCK: TokenSet = token_set_union![ +pub(super) const ATOM_EXPR_FIRST: TokenSet = token_set_union![ LITERAL_FIRST, token_set![ L_PAREN, + L_CURLY, L_BRACK, PIPE, MOVE_KW, @@ -59,9 +60,6 @@ pub(super) const ATOM_EXPR_FIRST_NO_BLOCK: TokenSet = token_set_union![ ], ]; -pub(super) const ATOM_EXPR_FIRST: TokenSet = - token_set_union![ATOM_EXPR_FIRST_NO_BLOCK, token_set![L_CURLY],]; - const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW]; pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMarker, BlockLike)> { @@ -442,8 +440,7 @@ fn break_expr(p: &mut Parser, r: Restrictions) -> CompletedMarker { // for i in break {} // match break {} // } - if r.forbid_structs && p.at_ts(EXPR_FIRST_NO_BLOCK) || !r.forbid_structs && p.at_ts(EXPR_FIRST) - { + if p.at_ts(EXPR_FIRST) && !(r.forbid_structs && p.at(L_CURLY)) { expr(p); } m.complete(p, BREAK_EXPR)