aboutsummaryrefslogtreecommitdiff
path: root/crates/parser/src/grammar/expressions
diff options
context:
space:
mode:
Diffstat (limited to 'crates/parser/src/grammar/expressions')
-rw-r--r--crates/parser/src/grammar/expressions/atom.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/crates/parser/src/grammar/expressions/atom.rs b/crates/parser/src/grammar/expressions/atom.rs
index 31f42f161..18b63feb7 100644
--- a/crates/parser/src/grammar/expressions/atom.rs
+++ b/crates/parser/src/grammar/expressions/atom.rs
@@ -48,7 +48,7 @@ pub(super) const ATOM_EXPR_FIRST: TokenSet =
48 T![try], 48 T![try],
49 T![loop], 49 T![loop],
50 T![for], 50 T![for],
51 LIFETIME, 51 LIFETIME_IDENT,
52 ])); 52 ]));
53 53
54const EXPR_RECOVERY_SET: TokenSet = TokenSet::new(&[LET_KW, R_DOLLAR]); 54const EXPR_RECOVERY_SET: TokenSet = TokenSet::new(&[LET_KW, R_DOLLAR]);
@@ -75,7 +75,7 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar
75 T![for] => for_expr(p, None), 75 T![for] => for_expr(p, None),
76 T![while] => while_expr(p, None), 76 T![while] => while_expr(p, None),
77 T![try] => try_block_expr(p, None), 77 T![try] => try_block_expr(p, None),
78 LIFETIME if la == T![:] => { 78 LIFETIME_IDENT if la == T![:] => {
79 let m = p.start(); 79 let m = p.start();
80 label(p); 80 label(p);
81 match p.current() { 81 match p.current() {
@@ -275,9 +275,9 @@ fn if_expr(p: &mut Parser) -> CompletedMarker {
275// 'c: for x in () {} 275// 'c: for x in () {}
276// } 276// }
277fn label(p: &mut Parser) { 277fn label(p: &mut Parser) {
278 assert!(p.at(LIFETIME) && p.nth(1) == T![:]); 278 assert!(p.at(LIFETIME_IDENT) && p.nth(1) == T![:]);
279 let m = p.start(); 279 let m = p.start();
280 p.bump(LIFETIME); 280 lifetime(p);
281 p.bump_any(); 281 p.bump_any();
282 m.complete(p, LABEL); 282 m.complete(p, LABEL);
283} 283}
@@ -501,7 +501,9 @@ fn continue_expr(p: &mut Parser) -> CompletedMarker {
501 assert!(p.at(T![continue])); 501 assert!(p.at(T![continue]));
502 let m = p.start(); 502 let m = p.start();
503 p.bump(T![continue]); 503 p.bump(T![continue]);
504 p.eat(LIFETIME); 504 if p.at(LIFETIME_IDENT) {
505 lifetime(p);
506 }
505 m.complete(p, CONTINUE_EXPR) 507 m.complete(p, CONTINUE_EXPR)
506} 508}
507 509
@@ -518,7 +520,9 @@ fn break_expr(p: &mut Parser, r: Restrictions) -> CompletedMarker {
518 assert!(p.at(T![break])); 520 assert!(p.at(T![break]));
519 let m = p.start(); 521 let m = p.start();
520 p.bump(T![break]); 522 p.bump(T![break]);
521 p.eat(LIFETIME); 523 if p.at(LIFETIME_IDENT) {
524 lifetime(p);
525 }
522 // test break_ambiguity 526 // test break_ambiguity
523 // fn foo(){ 527 // fn foo(){
524 // if break {} 528 // if break {}