diff options
Diffstat (limited to 'crates/ra_parser/src/grammar/expressions/atom.rs')
-rw-r--r-- | crates/ra_parser/src/grammar/expressions/atom.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs index 725fb99f6..41be283d0 100644 --- a/crates/ra_parser/src/grammar/expressions/atom.rs +++ b/crates/ra_parser/src/grammar/expressions/atom.rs | |||
@@ -74,6 +74,7 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar | |||
74 | T![if] => if_expr(p), | 74 | T![if] => if_expr(p), |
75 | 75 | ||
76 | T![loop] => loop_expr(p, None), | 76 | T![loop] => loop_expr(p, None), |
77 | T![box] => box_expr(p, None), | ||
77 | T![for] => for_expr(p, None), | 78 | T![for] => for_expr(p, None), |
78 | T![while] => while_expr(p, None), | 79 | T![while] => while_expr(p, None), |
79 | T![try] => try_block_expr(p, None), | 80 | T![try] => try_block_expr(p, None), |
@@ -507,3 +508,17 @@ fn try_block_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | |||
507 | block(p); | 508 | block(p); |
508 | m.complete(p, TRY_EXPR) | 509 | m.complete(p, TRY_EXPR) |
509 | } | 510 | } |
511 | |||
512 | // test box_expr | ||
513 | // fn foo() { | ||
514 | // let x = box 1i32; | ||
515 | // } | ||
516 | fn box_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | ||
517 | assert!(p.at(T![box])); | ||
518 | let m = m.unwrap_or_else(|| p.start()); | ||
519 | p.bump(); | ||
520 | if p.at_ts(EXPR_FIRST) { | ||
521 | expr(p); | ||
522 | } | ||
523 | m.complete(p, BOX_EXPR) | ||
524 | } | ||