aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/grammar
diff options
context:
space:
mode:
authorDJMcNab <[email protected]>2018-12-19 21:19:32 +0000
committerDJMcNab <[email protected]>2018-12-19 21:19:32 +0000
commita3b842fb8b7b5503b1c4fc49355edd4f2fe0d28d (patch)
tree8a6044df2e589d1dab26f9551b13360fac0e974f /crates/ra_syntax/src/grammar
parentdb677414304bec41a5eae57eea4eb0b546619415 (diff)
Add tests and only traverse in the crates directory
Diffstat (limited to 'crates/ra_syntax/src/grammar')
-rw-r--r--crates/ra_syntax/src/grammar/expressions.rs8
-rw-r--r--crates/ra_syntax/src/grammar/expressions/atom.rs1
2 files changed, 7 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/grammar/expressions.rs b/crates/ra_syntax/src/grammar/expressions.rs
index 5f5a3077d..4f8c46ab3 100644
--- a/crates/ra_syntax/src/grammar/expressions.rs
+++ b/crates/ra_syntax/src/grammar/expressions.rs
@@ -73,6 +73,10 @@ pub(crate) fn block(p: &mut Parser) {
73 // for _ in () {} 73 // for _ in () {}
74 // {} 74 // {}
75 // {} 75 // {}
76 // macro_rules! test {
77 // () => {}
78 // }
79 // test!{}
76 // } 80 // }
77 if is_blocklike { 81 if is_blocklike {
78 p.eat(SEMI); 82 p.eat(SEMI);
@@ -168,13 +172,13 @@ fn current_op(p: &Parser) -> (u8, Op) {
168// Parses expression with binding power of at least bp. 172// Parses expression with binding power of at least bp.
169fn expr_bp(p: &mut Parser, r: Restrictions, bp: u8) -> BlockLike { 173fn expr_bp(p: &mut Parser, r: Restrictions, bp: u8) -> BlockLike {
170 let mut lhs = match lhs(p, r) { 174 let mut lhs = match lhs(p, r) {
171 Some((lhs, macro_blocklike)) => { 175 Some((lhs, blocklike)) => {
172 // test stmt_bin_expr_ambiguity 176 // test stmt_bin_expr_ambiguity
173 // fn foo() { 177 // fn foo() {
174 // let _ = {1} & 2; 178 // let _ = {1} & 2;
175 // {1} &2; 179 // {1} &2;
176 // } 180 // }
177 if r.prefer_stmt && macro_blocklike.is_block() { 181 if r.prefer_stmt && blocklike.is_block() {
178 return BlockLike::Block; 182 return BlockLike::Block;
179 } 183 }
180 lhs 184 lhs
diff --git a/crates/ra_syntax/src/grammar/expressions/atom.rs b/crates/ra_syntax/src/grammar/expressions/atom.rs
index a976799e7..cd7d62aff 100644
--- a/crates/ra_syntax/src/grammar/expressions/atom.rs
+++ b/crates/ra_syntax/src/grammar/expressions/atom.rs
@@ -353,6 +353,7 @@ pub(crate) fn match_arm_list(p: &mut Parser) {
353// fn foo() { 353// fn foo() {
354// match () { 354// match () {
355// _ => (), 355// _ => (),
356// _ if Test>{field: 0} => (),
356// X | Y if Z => (), 357// X | Y if Z => (),
357// | X | Y if Z => (), 358// | X | Y if Z => (),
358// | X => (), 359// | X => (),