aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src/grammar/expressions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_parser/src/grammar/expressions.rs')
-rw-r--r--crates/ra_parser/src/grammar/expressions.rs26
1 files changed, 2 insertions, 24 deletions
diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs
index cb30b25a8..34f039768 100644
--- a/crates/ra_parser/src/grammar/expressions.rs
+++ b/crates/ra_parser/src/grammar/expressions.rs
@@ -2,7 +2,7 @@
2 2
3mod atom; 3mod atom;
4 4
5pub(crate) use self::atom::match_arm_list; 5pub(crate) use self::atom::{block_expr, match_arm_list};
6pub(super) use self::atom::{literal, LITERAL_FIRST}; 6pub(super) use self::atom::{literal, LITERAL_FIRST};
7use super::*; 7use super::*;
8 8
@@ -49,28 +49,6 @@ fn expr_no_struct(p: &mut Parser) {
49 expr_bp(p, r, 1); 49 expr_bp(p, r, 1);
50} 50}
51 51
52// test block
53// fn a() {}
54// fn b() { let _ = 1; }
55// fn c() { 1; 2; }
56// fn d() { 1; 2 }
57pub(crate) fn block(p: &mut Parser) {
58 if !p.at(T!['{']) {
59 p.error("expected a block");
60 return;
61 }
62 atom::block_expr(p, None);
63}
64
65pub(crate) fn naked_block(p: &mut Parser) {
66 assert!(p.at(T!['{']));
67 let m = p.start();
68 p.bump(T!['{']);
69 expr_block_contents(p);
70 p.expect(T!['}']);
71 m.complete(p, BLOCK);
72}
73
74fn is_expr_stmt_attr_allowed(kind: SyntaxKind) -> bool { 52fn is_expr_stmt_attr_allowed(kind: SyntaxKind) -> bool {
75 match kind { 53 match kind {
76 BIN_EXPR | RANGE_EXPR | IF_EXPR => false, 54 BIN_EXPR | RANGE_EXPR | IF_EXPR => false,
@@ -197,7 +175,7 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi) {
197 } 175 }
198} 176}
199 177
200pub(crate) fn expr_block_contents(p: &mut Parser) { 178pub(super) fn expr_block_contents(p: &mut Parser) {
201 // This is checked by a validator 179 // This is checked by a validator
202 attributes::inner_attributes(p); 180 attributes::inner_attributes(p);
203 181