aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src/grammar/expressions/atom.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-06-19 11:07:37 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-06-19 11:07:37 +0100
commit363f2f394e2c6423388a5e292adcccc38ee1df04 (patch)
treec5e2d9b59ce9985fc62c31b63f1bb778f38536c7 /crates/ra_parser/src/grammar/expressions/atom.rs
parent09864b3b217e2ad6ca8630af6faaaefd8d14e860 (diff)
parentd6533994e461dac502672c77ff27c6ca08fdc092 (diff)
Merge #1414
1414: fix: box_syntax/pattern r=matklad a=csmoe Closes #1412 r? @matklad Co-authored-by: csmoe <[email protected]>
Diffstat (limited to 'crates/ra_parser/src/grammar/expressions/atom.rs')
-rw-r--r--crates/ra_parser/src/grammar/expressions/atom.rs15
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// }
516fn 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}