aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/grammar/expressions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/grammar/expressions.rs')
-rw-r--r--crates/ra_syntax/src/grammar/expressions.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/crates/ra_syntax/src/grammar/expressions.rs b/crates/ra_syntax/src/grammar/expressions.rs
index 4f8c46ab3..da78d85a2 100644
--- a/crates/ra_syntax/src/grammar/expressions.rs
+++ b/crates/ra_syntax/src/grammar/expressions.rs
@@ -42,9 +42,15 @@ pub(crate) fn block(p: &mut Parser) {
42 } 42 }
43 let m = p.start(); 43 let m = p.start();
44 p.bump(); 44 p.bump();
45
45 while !p.at(EOF) && !p.at(R_CURLY) { 46 while !p.at(EOF) && !p.at(R_CURLY) {
46 match p.current() { 47 match p.current() {
47 LET_KW => let_stmt(p), 48 LET_KW => let_stmt(p),
49 // test nocontentexpr
50 // fn foo(){
51 // ;;;some_expr();;;;{;;;};;;;Ok(())
52 // }
53 SEMI => p.bump(),
48 _ => { 54 _ => {
49 // test block_items 55 // test block_items
50 // fn a() { fn b() {} } 56 // fn a() { fn b() {} }
@@ -206,7 +212,7 @@ fn expr_bp(p: &mut Parser, r: Restrictions, bp: u8) -> BlockLike {
206} 212}
207 213
208const LHS_FIRST: TokenSet = token_set_union![ 214const LHS_FIRST: TokenSet = token_set_union![
209 token_set![AMP, STAR, EXCL, DOTDOT, MINUS], 215 token_set![AMP, STAR, EXCL, DOTDOT, DOTDOTEQ, MINUS],
210 atom::ATOM_EXPR_FIRST, 216 atom::ATOM_EXPR_FIRST,
211]; 217];
212 218
@@ -237,7 +243,7 @@ fn lhs(p: &mut Parser, r: Restrictions) -> Option<(CompletedMarker, BlockLike)>
237 } 243 }
238 // test full_range_expr 244 // test full_range_expr
239 // fn foo() { xs[..]; } 245 // fn foo() { xs[..]; }
240 DOTDOT => { 246 DOTDOT | DOTDOTEQ => {
241 m = p.start(); 247 m = p.start();
242 p.bump(); 248 p.bump();
243 if p.at_ts(EXPR_FIRST) { 249 if p.at_ts(EXPR_FIRST) {
@@ -287,7 +293,7 @@ fn postfix_expr(
287 DOT if p.nth(1) == INT_NUMBER => field_expr(p, lhs), 293 DOT if p.nth(1) == INT_NUMBER => field_expr(p, lhs),
288 // test postfix_range 294 // test postfix_range
289 // fn foo() { let x = 1..; } 295 // fn foo() { let x = 1..; }
290 DOTDOT if !EXPR_FIRST.contains(p.nth(1)) => { 296 DOTDOT | DOTDOTEQ if !EXPR_FIRST.contains(p.nth(1)) => {
291 let m = lhs.precede(p); 297 let m = lhs.precede(p);
292 p.bump(); 298 p.bump();
293 m.complete(p, RANGE_EXPR) 299 m.complete(p, RANGE_EXPR)