diff options
Diffstat (limited to 'crates/ra_parser/src/grammar/expressions')
-rw-r--r-- | crates/ra_parser/src/grammar/expressions/atom.rs | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs index ec7f2441d..cea79cf6f 100644 --- a/crates/ra_parser/src/grammar/expressions/atom.rs +++ b/crates/ra_parser/src/grammar/expressions/atom.rs | |||
@@ -31,7 +31,7 @@ pub(crate) fn literal(p: &mut Parser) -> Option<CompletedMarker> { | |||
31 | return None; | 31 | return None; |
32 | } | 32 | } |
33 | let m = p.start(); | 33 | let m = p.start(); |
34 | p.bump(); | 34 | p.bump_any(); |
35 | Some(m.complete(p, LITERAL)) | 35 | Some(m.complete(p, LITERAL)) |
36 | } | 36 | } |
37 | 37 | ||
@@ -100,14 +100,14 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar | |||
100 | } | 100 | } |
101 | T![async] if la == T!['{'] || (la == T![move] && p.nth(2) == T!['{']) => { | 101 | T![async] if la == T!['{'] || (la == T![move] && p.nth(2) == T!['{']) => { |
102 | let m = p.start(); | 102 | let m = p.start(); |
103 | p.bump(); | 103 | p.bump_any(); |
104 | p.eat(T![move]); | 104 | p.eat(T![move]); |
105 | block_expr(p, Some(m)) | 105 | block_expr(p, Some(m)) |
106 | } | 106 | } |
107 | T![match] => match_expr(p), | 107 | T![match] => match_expr(p), |
108 | T![unsafe] if la == T!['{'] => { | 108 | T![unsafe] if la == T!['{'] => { |
109 | let m = p.start(); | 109 | let m = p.start(); |
110 | p.bump(); | 110 | p.bump_any(); |
111 | block_expr(p, Some(m)) | 111 | block_expr(p, Some(m)) |
112 | } | 112 | } |
113 | T!['{'] => { | 113 | T!['{'] => { |
@@ -179,7 +179,7 @@ fn tuple_expr(p: &mut Parser) -> CompletedMarker { | |||
179 | fn array_expr(p: &mut Parser) -> CompletedMarker { | 179 | fn array_expr(p: &mut Parser) -> CompletedMarker { |
180 | assert!(p.at(T!['['])); | 180 | assert!(p.at(T!['['])); |
181 | let m = p.start(); | 181 | let m = p.start(); |
182 | p.bump(); | 182 | p.bump_any(); |
183 | if p.eat(T![']']) { | 183 | if p.eat(T![']']) { |
184 | return m.complete(p, ARRAY_EXPR); | 184 | return m.complete(p, ARRAY_EXPR); |
185 | } | 185 | } |
@@ -261,11 +261,11 @@ fn lambda_expr(p: &mut Parser) -> CompletedMarker { | |||
261 | fn if_expr(p: &mut Parser) -> CompletedMarker { | 261 | fn if_expr(p: &mut Parser) -> CompletedMarker { |
262 | assert!(p.at(T![if])); | 262 | assert!(p.at(T![if])); |
263 | let m = p.start(); | 263 | let m = p.start(); |
264 | p.bump(); | 264 | p.bump_any(); |
265 | cond(p); | 265 | cond(p); |
266 | block(p); | 266 | block(p); |
267 | if p.at(T![else]) { | 267 | if p.at(T![else]) { |
268 | p.bump(); | 268 | p.bump_any(); |
269 | if p.at(T![if]) { | 269 | if p.at(T![if]) { |
270 | if_expr(p); | 270 | if_expr(p); |
271 | } else { | 271 | } else { |
@@ -284,8 +284,8 @@ fn if_expr(p: &mut Parser) -> CompletedMarker { | |||
284 | fn label(p: &mut Parser) { | 284 | fn label(p: &mut Parser) { |
285 | assert!(p.at(LIFETIME) && p.nth(1) == T![:]); | 285 | assert!(p.at(LIFETIME) && p.nth(1) == T![:]); |
286 | let m = p.start(); | 286 | let m = p.start(); |
287 | p.bump(); | 287 | p.bump_any(); |
288 | p.bump(); | 288 | p.bump_any(); |
289 | m.complete(p, LABEL); | 289 | m.complete(p, LABEL); |
290 | } | 290 | } |
291 | 291 | ||
@@ -296,7 +296,7 @@ fn label(p: &mut Parser) { | |||
296 | fn loop_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | 296 | fn loop_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { |
297 | assert!(p.at(T![loop])); | 297 | assert!(p.at(T![loop])); |
298 | let m = m.unwrap_or_else(|| p.start()); | 298 | let m = m.unwrap_or_else(|| p.start()); |
299 | p.bump(); | 299 | p.bump_any(); |
300 | block(p); | 300 | block(p); |
301 | m.complete(p, LOOP_EXPR) | 301 | m.complete(p, LOOP_EXPR) |
302 | } | 302 | } |
@@ -309,7 +309,7 @@ fn loop_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | |||
309 | fn while_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | 309 | fn while_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { |
310 | assert!(p.at(T![while])); | 310 | assert!(p.at(T![while])); |
311 | let m = m.unwrap_or_else(|| p.start()); | 311 | let m = m.unwrap_or_else(|| p.start()); |
312 | p.bump(); | 312 | p.bump_any(); |
313 | cond(p); | 313 | cond(p); |
314 | block(p); | 314 | block(p); |
315 | m.complete(p, WHILE_EXPR) | 315 | m.complete(p, WHILE_EXPR) |
@@ -322,7 +322,7 @@ fn while_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | |||
322 | fn for_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | 322 | fn for_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { |
323 | assert!(p.at(T![for])); | 323 | assert!(p.at(T![for])); |
324 | let m = m.unwrap_or_else(|| p.start()); | 324 | let m = m.unwrap_or_else(|| p.start()); |
325 | p.bump(); | 325 | p.bump_any(); |
326 | patterns::pattern(p); | 326 | patterns::pattern(p); |
327 | p.expect(T![in]); | 327 | p.expect(T![in]); |
328 | expr_no_struct(p); | 328 | expr_no_struct(p); |
@@ -356,7 +356,7 @@ fn cond(p: &mut Parser) { | |||
356 | fn match_expr(p: &mut Parser) -> CompletedMarker { | 356 | fn match_expr(p: &mut Parser) -> CompletedMarker { |
357 | assert!(p.at(T![match])); | 357 | assert!(p.at(T![match])); |
358 | let m = p.start(); | 358 | let m = p.start(); |
359 | p.bump(); | 359 | p.bump_any(); |
360 | expr_no_struct(p); | 360 | expr_no_struct(p); |
361 | if p.at(T!['{']) { | 361 | if p.at(T!['{']) { |
362 | match_arm_list(p); | 362 | match_arm_list(p); |
@@ -452,7 +452,7 @@ fn match_arm(p: &mut Parser) -> BlockLike { | |||
452 | fn match_guard(p: &mut Parser) -> CompletedMarker { | 452 | fn match_guard(p: &mut Parser) -> CompletedMarker { |
453 | assert!(p.at(T![if])); | 453 | assert!(p.at(T![if])); |
454 | let m = p.start(); | 454 | let m = p.start(); |
455 | p.bump(); | 455 | p.bump_any(); |
456 | expr(p); | 456 | expr(p); |
457 | m.complete(p, MATCH_GUARD) | 457 | m.complete(p, MATCH_GUARD) |
458 | } | 458 | } |
@@ -478,7 +478,7 @@ pub(super) fn block_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | |||
478 | fn return_expr(p: &mut Parser) -> CompletedMarker { | 478 | fn return_expr(p: &mut Parser) -> CompletedMarker { |
479 | assert!(p.at(T![return])); | 479 | assert!(p.at(T![return])); |
480 | let m = p.start(); | 480 | let m = p.start(); |
481 | p.bump(); | 481 | p.bump_any(); |
482 | if p.at_ts(EXPR_FIRST) { | 482 | if p.at_ts(EXPR_FIRST) { |
483 | expr(p); | 483 | expr(p); |
484 | } | 484 | } |
@@ -495,7 +495,7 @@ fn return_expr(p: &mut Parser) -> CompletedMarker { | |||
495 | fn continue_expr(p: &mut Parser) -> CompletedMarker { | 495 | fn continue_expr(p: &mut Parser) -> CompletedMarker { |
496 | assert!(p.at(T![continue])); | 496 | assert!(p.at(T![continue])); |
497 | let m = p.start(); | 497 | let m = p.start(); |
498 | p.bump(); | 498 | p.bump_any(); |
499 | p.eat(LIFETIME); | 499 | p.eat(LIFETIME); |
500 | m.complete(p, CONTINUE_EXPR) | 500 | m.complete(p, CONTINUE_EXPR) |
501 | } | 501 | } |
@@ -512,7 +512,7 @@ fn continue_expr(p: &mut Parser) -> CompletedMarker { | |||
512 | fn break_expr(p: &mut Parser, r: Restrictions) -> CompletedMarker { | 512 | fn break_expr(p: &mut Parser, r: Restrictions) -> CompletedMarker { |
513 | assert!(p.at(T![break])); | 513 | assert!(p.at(T![break])); |
514 | let m = p.start(); | 514 | let m = p.start(); |
515 | p.bump(); | 515 | p.bump_any(); |
516 | p.eat(LIFETIME); | 516 | p.eat(LIFETIME); |
517 | // test break_ambiguity | 517 | // test break_ambiguity |
518 | // fn foo(){ | 518 | // fn foo(){ |
@@ -534,7 +534,7 @@ fn break_expr(p: &mut Parser, r: Restrictions) -> CompletedMarker { | |||
534 | fn try_block_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | 534 | fn try_block_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { |
535 | assert!(p.at(T![try])); | 535 | assert!(p.at(T![try])); |
536 | let m = m.unwrap_or_else(|| p.start()); | 536 | let m = m.unwrap_or_else(|| p.start()); |
537 | p.bump(); | 537 | p.bump_any(); |
538 | block(p); | 538 | block(p); |
539 | m.complete(p, TRY_EXPR) | 539 | m.complete(p, TRY_EXPR) |
540 | } | 540 | } |
@@ -548,7 +548,7 @@ fn try_block_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | |||
548 | fn box_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | 548 | fn box_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { |
549 | assert!(p.at(T![box])); | 549 | assert!(p.at(T![box])); |
550 | let m = m.unwrap_or_else(|| p.start()); | 550 | let m = m.unwrap_or_else(|| p.start()); |
551 | p.bump(); | 551 | p.bump_any(); |
552 | if p.at_ts(EXPR_FIRST) { | 552 | if p.at_ts(EXPR_FIRST) { |
553 | expr(p); | 553 | expr(p); |
554 | } | 554 | } |