diff options
Diffstat (limited to 'crates')
3 files changed, 59 insertions, 12 deletions
diff --git a/crates/ra_syntax/src/grammar/expressions/atom.rs b/crates/ra_syntax/src/grammar/expressions/atom.rs index f01df56bc..a720d255f 100644 --- a/crates/ra_syntax/src/grammar/expressions/atom.rs +++ b/crates/ra_syntax/src/grammar/expressions/atom.rs | |||
@@ -319,10 +319,13 @@ pub(crate) fn match_arm_list(p: &mut Parser) { | |||
319 | // match () { | 319 | // match () { |
320 | // _ => (), | 320 | // _ => (), |
321 | // X | Y if Z => (), | 321 | // X | Y if Z => (), |
322 | // | X | Y if Z => (), | ||
323 | // | X => (), | ||
322 | // }; | 324 | // }; |
323 | // } | 325 | // } |
324 | fn match_arm(p: &mut Parser) -> BlockLike { | 326 | fn match_arm(p: &mut Parser) -> BlockLike { |
325 | let m = p.start(); | 327 | let m = p.start(); |
328 | p.eat(PIPE); | ||
326 | patterns::pattern_r(p, TokenSet::EMPTY); | 329 | patterns::pattern_r(p, TokenSet::EMPTY); |
327 | while p.eat(PIPE) { | 330 | while p.eat(PIPE) { |
328 | patterns::pattern(p); | 331 | patterns::pattern(p); |
diff --git a/crates/ra_syntax/tests/data/parser/inline/0069_match_arm.rs b/crates/ra_syntax/tests/data/parser/inline/0069_match_arm.rs index 2c0e88414..b23a12500 100644 --- a/crates/ra_syntax/tests/data/parser/inline/0069_match_arm.rs +++ b/crates/ra_syntax/tests/data/parser/inline/0069_match_arm.rs | |||
@@ -2,5 +2,7 @@ fn foo() { | |||
2 | match () { | 2 | match () { |
3 | _ => (), | 3 | _ => (), |
4 | X | Y if Z => (), | 4 | X | Y if Z => (), |
5 | | X | Y if Z => (), | ||
6 | | X => (), | ||
5 | }; | 7 | }; |
6 | } | 8 | } |
diff --git a/crates/ra_syntax/tests/data/parser/inline/0069_match_arm.txt b/crates/ra_syntax/tests/data/parser/inline/0069_match_arm.txt index 013d1716a..f862b1268 100644 --- a/crates/ra_syntax/tests/data/parser/inline/0069_match_arm.txt +++ b/crates/ra_syntax/tests/data/parser/inline/0069_match_arm.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | ROOT@[0; 78) | 1 | ROOT@[0; 125) |
2 | FN_DEF@[0; 77) | 2 | FN_DEF@[0; 124) |
3 | FN_KW@[0; 2) | 3 | FN_KW@[0; 2) |
4 | WHITESPACE@[2; 3) | 4 | WHITESPACE@[2; 3) |
5 | NAME@[3; 6) | 5 | NAME@[3; 6) |
@@ -8,18 +8,18 @@ ROOT@[0; 78) | |||
8 | L_PAREN@[6; 7) | 8 | L_PAREN@[6; 7) |
9 | R_PAREN@[7; 8) | 9 | R_PAREN@[7; 8) |
10 | WHITESPACE@[8; 9) | 10 | WHITESPACE@[8; 9) |
11 | BLOCK@[9; 77) | 11 | BLOCK@[9; 124) |
12 | L_CURLY@[9; 10) | 12 | L_CURLY@[9; 10) |
13 | WHITESPACE@[10; 15) | 13 | WHITESPACE@[10; 15) |
14 | EXPR_STMT@[15; 75) | 14 | EXPR_STMT@[15; 122) |
15 | MATCH_EXPR@[15; 74) | 15 | MATCH_EXPR@[15; 121) |
16 | MATCH_KW@[15; 20) | 16 | MATCH_KW@[15; 20) |
17 | WHITESPACE@[20; 21) | 17 | WHITESPACE@[20; 21) |
18 | TUPLE_EXPR@[21; 23) | 18 | TUPLE_EXPR@[21; 23) |
19 | L_PAREN@[21; 22) | 19 | L_PAREN@[21; 22) |
20 | R_PAREN@[22; 23) | 20 | R_PAREN@[22; 23) |
21 | WHITESPACE@[23; 24) | 21 | WHITESPACE@[23; 24) |
22 | MATCH_ARM_LIST@[24; 74) | 22 | MATCH_ARM_LIST@[24; 121) |
23 | L_CURLY@[24; 25) | 23 | L_CURLY@[24; 25) |
24 | WHITESPACE@[25; 34) | 24 | WHITESPACE@[25; 34) |
25 | MATCH_ARM@[34; 41) | 25 | MATCH_ARM@[34; 41) |
@@ -58,9 +58,51 @@ ROOT@[0; 78) | |||
58 | L_PAREN@[65; 66) | 58 | L_PAREN@[65; 66) |
59 | R_PAREN@[66; 67) | 59 | R_PAREN@[66; 67) |
60 | COMMA@[67; 68) | 60 | COMMA@[67; 68) |
61 | WHITESPACE@[68; 73) | 61 | WHITESPACE@[68; 77) |
62 | R_CURLY@[73; 74) | 62 | MATCH_ARM@[77; 95) |
63 | SEMI@[74; 75) | 63 | PIPE@[77; 78) |
64 | WHITESPACE@[75; 76) | 64 | WHITESPACE@[78; 79) |
65 | R_CURLY@[76; 77) | 65 | BIND_PAT@[79; 80) |
66 | WHITESPACE@[77; 78) | 66 | NAME@[79; 80) |
67 | IDENT@[79; 80) "X" | ||
68 | WHITESPACE@[80; 81) | ||
69 | PIPE@[81; 82) | ||
70 | WHITESPACE@[82; 83) | ||
71 | BIND_PAT@[83; 84) | ||
72 | NAME@[83; 84) | ||
73 | IDENT@[83; 84) "Y" | ||
74 | WHITESPACE@[84; 85) | ||
75 | IF_KW@[85; 87) | ||
76 | WHITESPACE@[87; 88) | ||
77 | PATH_EXPR@[88; 89) | ||
78 | PATH@[88; 89) | ||
79 | PATH_SEGMENT@[88; 89) | ||
80 | NAME_REF@[88; 89) | ||
81 | IDENT@[88; 89) "Z" | ||
82 | WHITESPACE@[89; 90) | ||
83 | FAT_ARROW@[90; 92) | ||
84 | WHITESPACE@[92; 93) | ||
85 | TUPLE_EXPR@[93; 95) | ||
86 | L_PAREN@[93; 94) | ||
87 | R_PAREN@[94; 95) | ||
88 | COMMA@[95; 96) | ||
89 | WHITESPACE@[96; 105) | ||
90 | MATCH_ARM@[105; 114) | ||
91 | PIPE@[105; 106) | ||
92 | WHITESPACE@[106; 107) | ||
93 | BIND_PAT@[107; 108) | ||
94 | NAME@[107; 108) | ||
95 | IDENT@[107; 108) "X" | ||
96 | WHITESPACE@[108; 109) | ||
97 | FAT_ARROW@[109; 111) | ||
98 | WHITESPACE@[111; 112) | ||
99 | TUPLE_EXPR@[112; 114) | ||
100 | L_PAREN@[112; 113) | ||
101 | R_PAREN@[113; 114) | ||
102 | COMMA@[114; 115) | ||
103 | WHITESPACE@[115; 120) | ||
104 | R_CURLY@[120; 121) | ||
105 | SEMI@[121; 122) | ||
106 | WHITESPACE@[122; 123) | ||
107 | R_CURLY@[123; 124) | ||
108 | WHITESPACE@[124; 125) | ||