diff options
4 files changed, 133 insertions, 133 deletions
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs index 53bb26c5f..d933288cd 100644 --- a/crates/ra_parser/src/grammar/expressions/atom.rs +++ b/crates/ra_parser/src/grammar/expressions/atom.rs | |||
@@ -342,21 +342,6 @@ pub(crate) fn match_arm_list(p: &mut Parser) { | |||
342 | continue; | 342 | continue; |
343 | } | 343 | } |
344 | 344 | ||
345 | // test match_arms_outer_attributes | ||
346 | // fn foo() { | ||
347 | // match () { | ||
348 | // #[cfg(feature = "some")] | ||
349 | // _ => (), | ||
350 | // #[cfg(feature = "other")] | ||
351 | // _ => (), | ||
352 | // #[cfg(feature = "many")] | ||
353 | // #[cfg(feature = "attributes")] | ||
354 | // #[cfg(feature = "before")] | ||
355 | // _ => (), | ||
356 | // } | ||
357 | // } | ||
358 | attributes::outer_attributes(p); | ||
359 | |||
360 | // test match_arms_commas | 345 | // test match_arms_commas |
361 | // fn foo() { | 346 | // fn foo() { |
362 | // match () { | 347 | // match () { |
@@ -387,6 +372,21 @@ pub(crate) fn match_arm_list(p: &mut Parser) { | |||
387 | // } | 372 | // } |
388 | fn match_arm(p: &mut Parser) -> BlockLike { | 373 | fn match_arm(p: &mut Parser) -> BlockLike { |
389 | let m = p.start(); | 374 | let m = p.start(); |
375 | // test match_arms_outer_attributes | ||
376 | // fn foo() { | ||
377 | // match () { | ||
378 | // #[cfg(feature = "some")] | ||
379 | // _ => (), | ||
380 | // #[cfg(feature = "other")] | ||
381 | // _ => (), | ||
382 | // #[cfg(feature = "many")] | ||
383 | // #[cfg(feature = "attributes")] | ||
384 | // #[cfg(feature = "before")] | ||
385 | // _ => (), | ||
386 | // } | ||
387 | // } | ||
388 | attributes::outer_attributes(p); | ||
389 | |||
390 | patterns::pattern_list_r(p, TokenSet::empty()); | 390 | patterns::pattern_list_r(p, TokenSet::empty()); |
391 | if p.at(IF_KW) { | 391 | if p.at(IF_KW) { |
392 | match_guard(p); | 392 | match_guard(p); |
diff --git a/crates/ra_syntax/tests/data/parser/err/0032_match_arms_inner_attrs.txt b/crates/ra_syntax/tests/data/parser/err/0032_match_arms_inner_attrs.txt index b7543abc9..ed5735a63 100644 --- a/crates/ra_syntax/tests/data/parser/err/0032_match_arms_inner_attrs.txt +++ b/crates/ra_syntax/tests/data/parser/err/0032_match_arms_inner_attrs.txt | |||
@@ -33,11 +33,11 @@ SOURCE_FILE@[0; 293) | |||
33 | R_PAREN@[40; 41) | 33 | R_PAREN@[40; 41) |
34 | COMMA@[41; 42) | 34 | COMMA@[41; 42) |
35 | WHITESPACE@[42; 51) | 35 | WHITESPACE@[42; 51) |
36 | ATTR@[51; 52) | 36 | MATCH_ARM@[51; 78) |
37 | POUND@[51; 52) | 37 | ATTR@[51; 52) |
38 | err: `expected `[`` | 38 | POUND@[51; 52) |
39 | err: `expected pattern` | 39 | err: `expected `[`` |
40 | MATCH_ARM@[52; 78) | 40 | err: `expected pattern` |
41 | ERROR@[52; 53) | 41 | ERROR@[52; 53) |
42 | EXCL@[52; 53) | 42 | EXCL@[52; 53) |
43 | err: `expected FAT_ARROW` | 43 | err: `expected FAT_ARROW` |
@@ -103,11 +103,11 @@ SOURCE_FILE@[0; 293) | |||
103 | R_PAREN@[149; 150) | 103 | R_PAREN@[149; 150) |
104 | COMMA@[150; 151) | 104 | COMMA@[150; 151) |
105 | WHITESPACE@[151; 160) | 105 | WHITESPACE@[151; 160) |
106 | ATTR@[160; 161) | 106 | MATCH_ARM@[160; 179) |
107 | POUND@[160; 161) | 107 | ATTR@[160; 161) |
108 | err: `expected `[`` | 108 | POUND@[160; 161) |
109 | err: `expected pattern` | 109 | err: `expected `[`` |
110 | MATCH_ARM@[161; 179) | 110 | err: `expected pattern` |
111 | ERROR@[161; 162) | 111 | ERROR@[161; 162) |
112 | EXCL@[161; 162) | 112 | EXCL@[161; 162) |
113 | err: `expected FAT_ARROW` | 113 | err: `expected FAT_ARROW` |
@@ -138,22 +138,22 @@ SOURCE_FILE@[0; 293) | |||
138 | MATCH_ARM_LIST@[200; 290) | 138 | MATCH_ARM_LIST@[200; 290) |
139 | L_CURLY@[200; 201) | 139 | L_CURLY@[200; 201) |
140 | WHITESPACE@[201; 210) | 140 | WHITESPACE@[201; 210) |
141 | ATTR@[210; 222) | 141 | MATCH_ARM@[210; 250) |
142 | POUND@[210; 211) | 142 | ATTR@[210; 222) |
143 | TOKEN_TREE@[211; 222) | 143 | POUND@[210; 211) |
144 | L_BRACK@[211; 212) | 144 | TOKEN_TREE@[211; 222) |
145 | IDENT@[212; 215) "cfg" | 145 | L_BRACK@[211; 212) |
146 | TOKEN_TREE@[215; 221) | 146 | IDENT@[212; 215) "cfg" |
147 | L_PAREN@[215; 216) | 147 | TOKEN_TREE@[215; 221) |
148 | IDENT@[216; 220) "test" | 148 | L_PAREN@[215; 216) |
149 | R_PAREN@[220; 221) | 149 | IDENT@[216; 220) "test" |
150 | R_BRACK@[221; 222) | 150 | R_PAREN@[220; 221) |
151 | WHITESPACE@[222; 231) | 151 | R_BRACK@[221; 222) |
152 | ATTR@[231; 232) | 152 | WHITESPACE@[222; 231) |
153 | POUND@[231; 232) | 153 | ATTR@[231; 232) |
154 | err: `expected `[`` | 154 | POUND@[231; 232) |
155 | err: `expected pattern` | 155 | err: `expected `[`` |
156 | MATCH_ARM@[232; 250) | 156 | err: `expected pattern` |
157 | ERROR@[232; 233) | 157 | ERROR@[232; 233) |
158 | EXCL@[232; 233) | 158 | EXCL@[232; 233) |
159 | err: `expected FAT_ARROW` | 159 | err: `expected FAT_ARROW` |
diff --git a/crates/ra_syntax/tests/data/parser/err/0033_match_arms_outer_attrs.txt b/crates/ra_syntax/tests/data/parser/err/0033_match_arms_outer_attrs.txt index 7f8767001..f540409bc 100644 --- a/crates/ra_syntax/tests/data/parser/err/0033_match_arms_outer_attrs.txt +++ b/crates/ra_syntax/tests/data/parser/err/0033_match_arms_outer_attrs.txt | |||
@@ -43,21 +43,21 @@ SOURCE_FILE@[0; 89) | |||
43 | R_PAREN@[57; 58) | 43 | R_PAREN@[57; 58) |
44 | COMMA@[58; 59) | 44 | COMMA@[58; 59) |
45 | WHITESPACE@[59; 68) | 45 | WHITESPACE@[59; 68) |
46 | ATTR@[68; 80) | 46 | MATCH_ARM@[68; 80) |
47 | POUND@[68; 69) | 47 | ATTR@[68; 80) |
48 | TOKEN_TREE@[69; 80) | 48 | POUND@[68; 69) |
49 | L_BRACK@[69; 70) | 49 | TOKEN_TREE@[69; 80) |
50 | IDENT@[70; 73) "cfg" | 50 | L_BRACK@[69; 70) |
51 | TOKEN_TREE@[73; 79) | 51 | IDENT@[70; 73) "cfg" |
52 | L_PAREN@[73; 74) | 52 | TOKEN_TREE@[73; 79) |
53 | IDENT@[74; 78) "test" | 53 | L_PAREN@[73; 74) |
54 | R_PAREN@[78; 79) | 54 | IDENT@[74; 78) "test" |
55 | R_BRACK@[79; 80) | 55 | R_PAREN@[78; 79) |
56 | R_BRACK@[79; 80) | ||
57 | err: `expected pattern` | ||
58 | err: `expected FAT_ARROW` | ||
59 | err: `expected expression` | ||
56 | WHITESPACE@[80; 85) | 60 | WHITESPACE@[80; 85) |
57 | err: `expected pattern` | ||
58 | err: `expected FAT_ARROW` | ||
59 | err: `expected expression` | ||
60 | MATCH_ARM@[85; 85) | ||
61 | R_CURLY@[85; 86) | 61 | R_CURLY@[85; 86) |
62 | WHITESPACE@[86; 87) | 62 | WHITESPACE@[86; 87) |
63 | R_CURLY@[87; 88) | 63 | R_CURLY@[87; 88) |
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0121_match_arms_outer_attributes.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0121_match_arms_outer_attributes.txt index c888fb8f0..e52a290bf 100644 --- a/crates/ra_syntax/tests/data/parser/inline/ok/0121_match_arms_outer_attributes.txt +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0121_match_arms_outer_attributes.txt | |||
@@ -21,22 +21,22 @@ SOURCE_FILE@[0; 259) | |||
21 | MATCH_ARM_LIST@[24; 256) | 21 | MATCH_ARM_LIST@[24; 256) |
22 | L_CURLY@[24; 25) | 22 | L_CURLY@[24; 25) |
23 | WHITESPACE@[25; 34) | 23 | WHITESPACE@[25; 34) |
24 | ATTR@[34; 58) | 24 | MATCH_ARM@[34; 74) |
25 | POUND@[34; 35) | 25 | ATTR@[34; 58) |
26 | TOKEN_TREE@[35; 58) | 26 | POUND@[34; 35) |
27 | L_BRACK@[35; 36) | 27 | TOKEN_TREE@[35; 58) |
28 | IDENT@[36; 39) "cfg" | 28 | L_BRACK@[35; 36) |
29 | TOKEN_TREE@[39; 57) | 29 | IDENT@[36; 39) "cfg" |
30 | L_PAREN@[39; 40) | 30 | TOKEN_TREE@[39; 57) |
31 | IDENT@[40; 47) "feature" | 31 | L_PAREN@[39; 40) |
32 | WHITESPACE@[47; 48) | 32 | IDENT@[40; 47) "feature" |
33 | EQ@[48; 49) | 33 | WHITESPACE@[47; 48) |
34 | WHITESPACE@[49; 50) | 34 | EQ@[48; 49) |
35 | STRING@[50; 56) | 35 | WHITESPACE@[49; 50) |
36 | R_PAREN@[56; 57) | 36 | STRING@[50; 56) |
37 | R_BRACK@[57; 58) | 37 | R_PAREN@[56; 57) |
38 | WHITESPACE@[58; 67) | 38 | R_BRACK@[57; 58) |
39 | MATCH_ARM@[67; 74) | 39 | WHITESPACE@[58; 67) |
40 | PLACEHOLDER_PAT@[67; 68) | 40 | PLACEHOLDER_PAT@[67; 68) |
41 | UNDERSCORE@[67; 68) | 41 | UNDERSCORE@[67; 68) |
42 | WHITESPACE@[68; 69) | 42 | WHITESPACE@[68; 69) |
@@ -47,22 +47,22 @@ SOURCE_FILE@[0; 259) | |||
47 | R_PAREN@[73; 74) | 47 | R_PAREN@[73; 74) |
48 | COMMA@[74; 75) | 48 | COMMA@[74; 75) |
49 | WHITESPACE@[75; 84) | 49 | WHITESPACE@[75; 84) |
50 | ATTR@[84; 109) | 50 | MATCH_ARM@[84; 125) |
51 | POUND@[84; 85) | 51 | ATTR@[84; 109) |
52 | TOKEN_TREE@[85; 109) | 52 | POUND@[84; 85) |
53 | L_BRACK@[85; 86) | 53 | TOKEN_TREE@[85; 109) |
54 | IDENT@[86; 89) "cfg" | 54 | L_BRACK@[85; 86) |
55 | TOKEN_TREE@[89; 108) | 55 | IDENT@[86; 89) "cfg" |
56 | L_PAREN@[89; 90) | 56 | TOKEN_TREE@[89; 108) |
57 | IDENT@[90; 97) "feature" | 57 | L_PAREN@[89; 90) |
58 | WHITESPACE@[97; 98) | 58 | IDENT@[90; 97) "feature" |
59 | EQ@[98; 99) | 59 | WHITESPACE@[97; 98) |
60 | WHITESPACE@[99; 100) | 60 | EQ@[98; 99) |
61 | STRING@[100; 107) | 61 | WHITESPACE@[99; 100) |
62 | R_PAREN@[107; 108) | 62 | STRING@[100; 107) |
63 | R_BRACK@[108; 109) | 63 | R_PAREN@[107; 108) |
64 | WHITESPACE@[109; 118) | 64 | R_BRACK@[108; 109) |
65 | MATCH_ARM@[118; 125) | 65 | WHITESPACE@[109; 118) |
66 | PLACEHOLDER_PAT@[118; 119) | 66 | PLACEHOLDER_PAT@[118; 119) |
67 | UNDERSCORE@[118; 119) | 67 | UNDERSCORE@[118; 119) |
68 | WHITESPACE@[119; 120) | 68 | WHITESPACE@[119; 120) |
@@ -73,52 +73,52 @@ SOURCE_FILE@[0; 259) | |||
73 | R_PAREN@[124; 125) | 73 | R_PAREN@[124; 125) |
74 | COMMA@[125; 126) | 74 | COMMA@[125; 126) |
75 | WHITESPACE@[126; 135) | 75 | WHITESPACE@[126; 135) |
76 | ATTR@[135; 159) | 76 | MATCH_ARM@[135; 249) |
77 | POUND@[135; 136) | 77 | ATTR@[135; 159) |
78 | TOKEN_TREE@[136; 159) | 78 | POUND@[135; 136) |
79 | L_BRACK@[136; 137) | 79 | TOKEN_TREE@[136; 159) |
80 | IDENT@[137; 140) "cfg" | 80 | L_BRACK@[136; 137) |
81 | TOKEN_TREE@[140; 158) | 81 | IDENT@[137; 140) "cfg" |
82 | L_PAREN@[140; 141) | 82 | TOKEN_TREE@[140; 158) |
83 | IDENT@[141; 148) "feature" | 83 | L_PAREN@[140; 141) |
84 | WHITESPACE@[148; 149) | 84 | IDENT@[141; 148) "feature" |
85 | EQ@[149; 150) | 85 | WHITESPACE@[148; 149) |
86 | WHITESPACE@[150; 151) | 86 | EQ@[149; 150) |
87 | STRING@[151; 157) | 87 | WHITESPACE@[150; 151) |
88 | R_PAREN@[157; 158) | 88 | STRING@[151; 157) |
89 | R_BRACK@[158; 159) | 89 | R_PAREN@[157; 158) |
90 | WHITESPACE@[159; 168) | 90 | R_BRACK@[158; 159) |
91 | ATTR@[168; 198) | 91 | WHITESPACE@[159; 168) |
92 | POUND@[168; 169) | 92 | ATTR@[168; 198) |
93 | TOKEN_TREE@[169; 198) | 93 | POUND@[168; 169) |
94 | L_BRACK@[169; 170) | 94 | TOKEN_TREE@[169; 198) |
95 | IDENT@[170; 173) "cfg" | 95 | L_BRACK@[169; 170) |
96 | TOKEN_TREE@[173; 197) | 96 | IDENT@[170; 173) "cfg" |
97 | L_PAREN@[173; 174) | 97 | TOKEN_TREE@[173; 197) |
98 | IDENT@[174; 181) "feature" | 98 | L_PAREN@[173; 174) |
99 | WHITESPACE@[181; 182) | 99 | IDENT@[174; 181) "feature" |
100 | EQ@[182; 183) | 100 | WHITESPACE@[181; 182) |
101 | WHITESPACE@[183; 184) | 101 | EQ@[182; 183) |
102 | STRING@[184; 196) | 102 | WHITESPACE@[183; 184) |
103 | R_PAREN@[196; 197) | 103 | STRING@[184; 196) |
104 | R_BRACK@[197; 198) | 104 | R_PAREN@[196; 197) |
105 | WHITESPACE@[198; 207) | 105 | R_BRACK@[197; 198) |
106 | ATTR@[207; 233) | 106 | WHITESPACE@[198; 207) |
107 | POUND@[207; 208) | 107 | ATTR@[207; 233) |
108 | TOKEN_TREE@[208; 233) | 108 | POUND@[207; 208) |
109 | L_BRACK@[208; 209) | 109 | TOKEN_TREE@[208; 233) |
110 | IDENT@[209; 212) "cfg" | 110 | L_BRACK@[208; 209) |
111 | TOKEN_TREE@[212; 232) | 111 | IDENT@[209; 212) "cfg" |
112 | L_PAREN@[212; 213) | 112 | TOKEN_TREE@[212; 232) |
113 | IDENT@[213; 220) "feature" | 113 | L_PAREN@[212; 213) |
114 | WHITESPACE@[220; 221) | 114 | IDENT@[213; 220) "feature" |
115 | EQ@[221; 222) | 115 | WHITESPACE@[220; 221) |
116 | WHITESPACE@[222; 223) | 116 | EQ@[221; 222) |
117 | STRING@[223; 231) | 117 | WHITESPACE@[222; 223) |
118 | R_PAREN@[231; 232) | 118 | STRING@[223; 231) |
119 | R_BRACK@[232; 233) | 119 | R_PAREN@[231; 232) |
120 | WHITESPACE@[233; 242) | 120 | R_BRACK@[232; 233) |
121 | MATCH_ARM@[242; 249) | 121 | WHITESPACE@[233; 242) |
122 | PLACEHOLDER_PAT@[242; 243) | 122 | PLACEHOLDER_PAT@[242; 243) |
123 | UNDERSCORE@[242; 243) | 123 | UNDERSCORE@[242; 243) |
124 | WHITESPACE@[243; 244) | 124 | WHITESPACE@[243; 244) |