diff options
author | Ville Penttinen <[email protected]> | 2019-02-17 17:08:34 +0000 |
---|---|---|
committer | Ville Penttinen <[email protected]> | 2019-02-17 17:26:57 +0000 |
commit | 1c97c1ac11459d45f7bfc57dc72428d2b294520c (patch) | |
tree | 70638cabf61f96a7511f974cc66dae40175bfb22 /crates/ra_syntax/tests/data/parser/err/0032_match_arms_inner_attrs.txt | |
parent | 982f72c022b45629e6adbaef22884359d3495ecf (diff) |
Enable parsing of attributes inside a match block
We allow invalid inner attributes to be parsed, e.g. inner attributes that are
not directly after the opening brace of the match block.
Instead we run validation on `MatchArmList` to allow better reporting of errors.
Diffstat (limited to 'crates/ra_syntax/tests/data/parser/err/0032_match_arms_inner_attrs.txt')
-rw-r--r-- | crates/ra_syntax/tests/data/parser/err/0032_match_arms_inner_attrs.txt | 173 |
1 files changed, 173 insertions, 0 deletions
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 new file mode 100644 index 000000000..b3ff36364 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/err/0032_match_arms_inner_attrs.txt | |||
@@ -0,0 +1,173 @@ | |||
1 | SOURCE_FILE@[0; 293) | ||
2 | FN_DEF@[0; 292) | ||
3 | FN_KW@[0; 2) | ||
4 | WHITESPACE@[2; 3) | ||
5 | NAME@[3; 6) | ||
6 | IDENT@[3; 6) "foo" | ||
7 | PARAM_LIST@[6; 8) | ||
8 | L_PAREN@[6; 7) | ||
9 | R_PAREN@[7; 8) | ||
10 | WHITESPACE@[8; 9) | ||
11 | BLOCK@[9; 292) | ||
12 | L_CURLY@[9; 10) | ||
13 | WHITESPACE@[10; 15) | ||
14 | EXPR_STMT@[15; 101) | ||
15 | MATCH_EXPR@[15; 101) | ||
16 | MATCH_KW@[15; 20) | ||
17 | WHITESPACE@[20; 21) | ||
18 | TUPLE_EXPR@[21; 23) | ||
19 | L_PAREN@[21; 22) | ||
20 | R_PAREN@[22; 23) | ||
21 | WHITESPACE@[23; 24) | ||
22 | MATCH_ARM_LIST@[24; 101) | ||
23 | L_CURLY@[24; 25) | ||
24 | WHITESPACE@[25; 34) | ||
25 | MATCH_ARM@[34; 41) | ||
26 | PLACEHOLDER_PAT@[34; 35) | ||
27 | UNDERSCORE@[34; 35) | ||
28 | WHITESPACE@[35; 36) | ||
29 | FAT_ARROW@[36; 38) | ||
30 | WHITESPACE@[38; 39) | ||
31 | TUPLE_EXPR@[39; 41) | ||
32 | L_PAREN@[39; 40) | ||
33 | R_PAREN@[40; 41) | ||
34 | COMMA@[41; 42) | ||
35 | WHITESPACE@[42; 51) | ||
36 | err: `Inner attributes are only allowed directly after the opening brace of the match expression` | ||
37 | ATTR@[51; 78) | ||
38 | POUND@[51; 52) | ||
39 | EXCL@[52; 53) | ||
40 | TOKEN_TREE@[53; 78) | ||
41 | L_BRACK@[53; 54) | ||
42 | IDENT@[54; 57) "doc" | ||
43 | TOKEN_TREE@[57; 77) | ||
44 | L_PAREN@[57; 58) | ||
45 | STRING@[58; 76) | ||
46 | R_PAREN@[76; 77) | ||
47 | R_BRACK@[77; 78) | ||
48 | WHITESPACE@[78; 87) | ||
49 | MATCH_ARM@[87; 94) | ||
50 | PLACEHOLDER_PAT@[87; 88) | ||
51 | UNDERSCORE@[87; 88) | ||
52 | WHITESPACE@[88; 89) | ||
53 | FAT_ARROW@[89; 91) | ||
54 | WHITESPACE@[91; 92) | ||
55 | TUPLE_EXPR@[92; 94) | ||
56 | L_PAREN@[92; 93) | ||
57 | R_PAREN@[93; 94) | ||
58 | COMMA@[94; 95) | ||
59 | WHITESPACE@[95; 100) | ||
60 | R_CURLY@[100; 101) | ||
61 | WHITESPACE@[101; 107) | ||
62 | EXPR_STMT@[107; 185) | ||
63 | MATCH_EXPR@[107; 185) | ||
64 | MATCH_KW@[107; 112) | ||
65 | WHITESPACE@[112; 113) | ||
66 | TUPLE_EXPR@[113; 115) | ||
67 | L_PAREN@[113; 114) | ||
68 | R_PAREN@[114; 115) | ||
69 | WHITESPACE@[115; 116) | ||
70 | MATCH_ARM_LIST@[116; 185) | ||
71 | L_CURLY@[116; 117) | ||
72 | WHITESPACE@[117; 126) | ||
73 | MATCH_ARM@[126; 133) | ||
74 | PLACEHOLDER_PAT@[126; 127) | ||
75 | UNDERSCORE@[126; 127) | ||
76 | WHITESPACE@[127; 128) | ||
77 | FAT_ARROW@[128; 130) | ||
78 | WHITESPACE@[130; 131) | ||
79 | TUPLE_EXPR@[131; 133) | ||
80 | L_PAREN@[131; 132) | ||
81 | R_PAREN@[132; 133) | ||
82 | COMMA@[133; 134) | ||
83 | WHITESPACE@[134; 143) | ||
84 | MATCH_ARM@[143; 150) | ||
85 | PLACEHOLDER_PAT@[143; 144) | ||
86 | UNDERSCORE@[143; 144) | ||
87 | WHITESPACE@[144; 145) | ||
88 | FAT_ARROW@[145; 147) | ||
89 | WHITESPACE@[147; 148) | ||
90 | TUPLE_EXPR@[148; 150) | ||
91 | L_PAREN@[148; 149) | ||
92 | R_PAREN@[149; 150) | ||
93 | COMMA@[150; 151) | ||
94 | WHITESPACE@[151; 160) | ||
95 | err: `Inner attributes are only allowed directly after the opening brace of the match expression` | ||
96 | ATTR@[160; 179) | ||
97 | POUND@[160; 161) | ||
98 | EXCL@[161; 162) | ||
99 | TOKEN_TREE@[162; 179) | ||
100 | L_BRACK@[162; 163) | ||
101 | IDENT@[163; 166) "doc" | ||
102 | TOKEN_TREE@[166; 178) | ||
103 | L_PAREN@[166; 167) | ||
104 | STRING@[167; 177) | ||
105 | R_PAREN@[177; 178) | ||
106 | R_BRACK@[178; 179) | ||
107 | WHITESPACE@[179; 184) | ||
108 | err: `expected pattern` | ||
109 | err: `expected FAT_ARROW` | ||
110 | err: `expected expression` | ||
111 | MATCH_ARM@[184; 184) | ||
112 | R_CURLY@[184; 185) | ||
113 | WHITESPACE@[185; 191) | ||
114 | MATCH_EXPR@[191; 290) | ||
115 | MATCH_KW@[191; 196) | ||
116 | WHITESPACE@[196; 197) | ||
117 | TUPLE_EXPR@[197; 199) | ||
118 | L_PAREN@[197; 198) | ||
119 | R_PAREN@[198; 199) | ||
120 | WHITESPACE@[199; 200) | ||
121 | MATCH_ARM_LIST@[200; 290) | ||
122 | L_CURLY@[200; 201) | ||
123 | WHITESPACE@[201; 210) | ||
124 | ATTR@[210; 222) | ||
125 | POUND@[210; 211) | ||
126 | TOKEN_TREE@[211; 222) | ||
127 | L_BRACK@[211; 212) | ||
128 | IDENT@[212; 215) "cfg" | ||
129 | TOKEN_TREE@[215; 221) | ||
130 | L_PAREN@[215; 216) | ||
131 | IDENT@[216; 220) "test" | ||
132 | R_PAREN@[220; 221) | ||
133 | R_BRACK@[221; 222) | ||
134 | WHITESPACE@[222; 231) | ||
135 | err: `Inner attributes are only allowed directly after the opening brace of the match expression` | ||
136 | ATTR@[231; 250) | ||
137 | POUND@[231; 232) | ||
138 | EXCL@[232; 233) | ||
139 | TOKEN_TREE@[233; 250) | ||
140 | L_BRACK@[233; 234) | ||
141 | IDENT@[234; 237) "doc" | ||
142 | TOKEN_TREE@[237; 249) | ||
143 | L_PAREN@[237; 238) | ||
144 | STRING@[238; 248) | ||
145 | R_PAREN@[248; 249) | ||
146 | R_BRACK@[249; 250) | ||
147 | WHITESPACE@[250; 259) | ||
148 | MATCH_ARM@[259; 266) | ||
149 | PLACEHOLDER_PAT@[259; 260) | ||
150 | UNDERSCORE@[259; 260) | ||
151 | WHITESPACE@[260; 261) | ||
152 | FAT_ARROW@[261; 263) | ||
153 | WHITESPACE@[263; 264) | ||
154 | TUPLE_EXPR@[264; 266) | ||
155 | L_PAREN@[264; 265) | ||
156 | R_PAREN@[265; 266) | ||
157 | COMMA@[266; 267) | ||
158 | WHITESPACE@[267; 276) | ||
159 | MATCH_ARM@[276; 283) | ||
160 | PLACEHOLDER_PAT@[276; 277) | ||
161 | UNDERSCORE@[276; 277) | ||
162 | WHITESPACE@[277; 278) | ||
163 | FAT_ARROW@[278; 280) | ||
164 | WHITESPACE@[280; 281) | ||
165 | TUPLE_EXPR@[281; 283) | ||
166 | L_PAREN@[281; 282) | ||
167 | R_PAREN@[282; 283) | ||
168 | COMMA@[283; 284) | ||
169 | WHITESPACE@[284; 289) | ||
170 | R_CURLY@[289; 290) | ||
171 | WHITESPACE@[290; 291) | ||
172 | R_CURLY@[291; 292) | ||
173 | WHITESPACE@[292; 293) | ||