diff options
Diffstat (limited to 'crates/ra_syntax/test_data/parser/inline')
12 files changed, 485 insertions, 21 deletions
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.rs b/crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.rs index 80c0a43f5..7811f52c0 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.rs | |||
@@ -4,4 +4,10 @@ impl S { | |||
4 | fn c(&'a self,) {} | 4 | fn c(&'a self,) {} |
5 | fn d(&'a mut self, x: i32) {} | 5 | fn d(&'a mut self, x: i32) {} |
6 | fn e(mut self) {} | 6 | fn e(mut self) {} |
7 | fn f(#[must_use] self) {} | ||
8 | fn g1(#[attr] self) {} | ||
9 | fn g2(#[attr] &self) {} | ||
10 | fn g3<'a>(#[attr] &mut self) {} | ||
11 | fn g4<'a>(#[attr] &'a self) {} | ||
12 | fn g5<'a>(#[attr] &'a mut self) {} | ||
7 | } | 13 | } |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.txt b/crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.txt index 8e210a6ca..5c75b6c75 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 128) | 1 | SOURCE_FILE@[0; 323) |
2 | IMPL_BLOCK@[0; 127) | 2 | IMPL_BLOCK@[0; 322) |
3 | IMPL_KW@[0; 4) "impl" | 3 | IMPL_KW@[0; 4) "impl" |
4 | WHITESPACE@[4; 5) " " | 4 | WHITESPACE@[4; 5) " " |
5 | PATH_TYPE@[5; 6) | 5 | PATH_TYPE@[5; 6) |
@@ -8,7 +8,7 @@ SOURCE_FILE@[0; 128) | |||
8 | NAME_REF@[5; 6) | 8 | NAME_REF@[5; 6) |
9 | IDENT@[5; 6) "S" | 9 | IDENT@[5; 6) "S" |
10 | WHITESPACE@[6; 7) " " | 10 | WHITESPACE@[6; 7) " " |
11 | ITEM_LIST@[7; 127) | 11 | ITEM_LIST@[7; 322) |
12 | L_CURLY@[7; 8) "{" | 12 | L_CURLY@[7; 8) "{" |
13 | WHITESPACE@[8; 13) "\n " | 13 | WHITESPACE@[8; 13) "\n " |
14 | FN_DEF@[13; 26) | 14 | FN_DEF@[13; 26) |
@@ -111,6 +111,165 @@ SOURCE_FILE@[0; 128) | |||
111 | BLOCK@[123; 125) | 111 | BLOCK@[123; 125) |
112 | L_CURLY@[123; 124) "{" | 112 | L_CURLY@[123; 124) "{" |
113 | R_CURLY@[124; 125) "}" | 113 | R_CURLY@[124; 125) "}" |
114 | WHITESPACE@[125; 126) "\n" | 114 | WHITESPACE@[125; 130) "\n " |
115 | R_CURLY@[126; 127) "}" | 115 | FN_DEF@[130; 155) |
116 | WHITESPACE@[127; 128) "\n" | 116 | FN_KW@[130; 132) "fn" |
117 | WHITESPACE@[132; 133) " " | ||
118 | NAME@[133; 134) | ||
119 | IDENT@[133; 134) "f" | ||
120 | PARAM_LIST@[134; 152) | ||
121 | L_PAREN@[134; 135) "(" | ||
122 | ATTR@[135; 146) | ||
123 | POUND@[135; 136) "#" | ||
124 | TOKEN_TREE@[136; 146) | ||
125 | L_BRACK@[136; 137) "[" | ||
126 | IDENT@[137; 145) "must_use" | ||
127 | R_BRACK@[145; 146) "]" | ||
128 | WHITESPACE@[146; 147) " " | ||
129 | SELF_PARAM@[147; 151) | ||
130 | SELF_KW@[147; 151) "self" | ||
131 | R_PAREN@[151; 152) ")" | ||
132 | WHITESPACE@[152; 153) " " | ||
133 | BLOCK@[153; 155) | ||
134 | L_CURLY@[153; 154) "{" | ||
135 | R_CURLY@[154; 155) "}" | ||
136 | WHITESPACE@[155; 160) "\n " | ||
137 | FN_DEF@[160; 182) | ||
138 | FN_KW@[160; 162) "fn" | ||
139 | WHITESPACE@[162; 163) " " | ||
140 | NAME@[163; 165) | ||
141 | IDENT@[163; 165) "g1" | ||
142 | PARAM_LIST@[165; 179) | ||
143 | L_PAREN@[165; 166) "(" | ||
144 | ATTR@[166; 173) | ||
145 | POUND@[166; 167) "#" | ||
146 | TOKEN_TREE@[167; 173) | ||
147 | L_BRACK@[167; 168) "[" | ||
148 | IDENT@[168; 172) "attr" | ||
149 | R_BRACK@[172; 173) "]" | ||
150 | WHITESPACE@[173; 174) " " | ||
151 | SELF_PARAM@[174; 178) | ||
152 | SELF_KW@[174; 178) "self" | ||
153 | R_PAREN@[178; 179) ")" | ||
154 | WHITESPACE@[179; 180) " " | ||
155 | BLOCK@[180; 182) | ||
156 | L_CURLY@[180; 181) "{" | ||
157 | R_CURLY@[181; 182) "}" | ||
158 | WHITESPACE@[182; 187) "\n " | ||
159 | FN_DEF@[187; 210) | ||
160 | FN_KW@[187; 189) "fn" | ||
161 | WHITESPACE@[189; 190) " " | ||
162 | NAME@[190; 192) | ||
163 | IDENT@[190; 192) "g2" | ||
164 | PARAM_LIST@[192; 207) | ||
165 | L_PAREN@[192; 193) "(" | ||
166 | ATTR@[193; 200) | ||
167 | POUND@[193; 194) "#" | ||
168 | TOKEN_TREE@[194; 200) | ||
169 | L_BRACK@[194; 195) "[" | ||
170 | IDENT@[195; 199) "attr" | ||
171 | R_BRACK@[199; 200) "]" | ||
172 | WHITESPACE@[200; 201) " " | ||
173 | SELF_PARAM@[201; 206) | ||
174 | AMP@[201; 202) "&" | ||
175 | SELF_KW@[202; 206) "self" | ||
176 | R_PAREN@[206; 207) ")" | ||
177 | WHITESPACE@[207; 208) " " | ||
178 | BLOCK@[208; 210) | ||
179 | L_CURLY@[208; 209) "{" | ||
180 | R_CURLY@[209; 210) "}" | ||
181 | WHITESPACE@[210; 215) "\n " | ||
182 | FN_DEF@[215; 246) | ||
183 | FN_KW@[215; 217) "fn" | ||
184 | WHITESPACE@[217; 218) " " | ||
185 | NAME@[218; 220) | ||
186 | IDENT@[218; 220) "g3" | ||
187 | TYPE_PARAM_LIST@[220; 224) | ||
188 | L_ANGLE@[220; 221) "<" | ||
189 | LIFETIME_PARAM@[221; 223) | ||
190 | LIFETIME@[221; 223) "\'a" | ||
191 | R_ANGLE@[223; 224) ">" | ||
192 | PARAM_LIST@[224; 243) | ||
193 | L_PAREN@[224; 225) "(" | ||
194 | ATTR@[225; 232) | ||
195 | POUND@[225; 226) "#" | ||
196 | TOKEN_TREE@[226; 232) | ||
197 | L_BRACK@[226; 227) "[" | ||
198 | IDENT@[227; 231) "attr" | ||
199 | R_BRACK@[231; 232) "]" | ||
200 | WHITESPACE@[232; 233) " " | ||
201 | SELF_PARAM@[233; 242) | ||
202 | AMP@[233; 234) "&" | ||
203 | MUT_KW@[234; 237) "mut" | ||
204 | WHITESPACE@[237; 238) " " | ||
205 | SELF_KW@[238; 242) "self" | ||
206 | R_PAREN@[242; 243) ")" | ||
207 | WHITESPACE@[243; 244) " " | ||
208 | BLOCK@[244; 246) | ||
209 | L_CURLY@[244; 245) "{" | ||
210 | R_CURLY@[245; 246) "}" | ||
211 | WHITESPACE@[246; 251) "\n " | ||
212 | FN_DEF@[251; 281) | ||
213 | FN_KW@[251; 253) "fn" | ||
214 | WHITESPACE@[253; 254) " " | ||
215 | NAME@[254; 256) | ||
216 | IDENT@[254; 256) "g4" | ||
217 | TYPE_PARAM_LIST@[256; 260) | ||
218 | L_ANGLE@[256; 257) "<" | ||
219 | LIFETIME_PARAM@[257; 259) | ||
220 | LIFETIME@[257; 259) "\'a" | ||
221 | R_ANGLE@[259; 260) ">" | ||
222 | PARAM_LIST@[260; 278) | ||
223 | L_PAREN@[260; 261) "(" | ||
224 | ATTR@[261; 268) | ||
225 | POUND@[261; 262) "#" | ||
226 | TOKEN_TREE@[262; 268) | ||
227 | L_BRACK@[262; 263) "[" | ||
228 | IDENT@[263; 267) "attr" | ||
229 | R_BRACK@[267; 268) "]" | ||
230 | WHITESPACE@[268; 269) " " | ||
231 | SELF_PARAM@[269; 277) | ||
232 | AMP@[269; 270) "&" | ||
233 | LIFETIME@[270; 272) "\'a" | ||
234 | WHITESPACE@[272; 273) " " | ||
235 | SELF_KW@[273; 277) "self" | ||
236 | R_PAREN@[277; 278) ")" | ||
237 | WHITESPACE@[278; 279) " " | ||
238 | BLOCK@[279; 281) | ||
239 | L_CURLY@[279; 280) "{" | ||
240 | R_CURLY@[280; 281) "}" | ||
241 | WHITESPACE@[281; 286) "\n " | ||
242 | FN_DEF@[286; 320) | ||
243 | FN_KW@[286; 288) "fn" | ||
244 | WHITESPACE@[288; 289) " " | ||
245 | NAME@[289; 291) | ||
246 | IDENT@[289; 291) "g5" | ||
247 | TYPE_PARAM_LIST@[291; 295) | ||
248 | L_ANGLE@[291; 292) "<" | ||
249 | LIFETIME_PARAM@[292; 294) | ||
250 | LIFETIME@[292; 294) "\'a" | ||
251 | R_ANGLE@[294; 295) ">" | ||
252 | PARAM_LIST@[295; 317) | ||
253 | L_PAREN@[295; 296) "(" | ||
254 | ATTR@[296; 303) | ||
255 | POUND@[296; 297) "#" | ||
256 | TOKEN_TREE@[297; 303) | ||
257 | L_BRACK@[297; 298) "[" | ||
258 | IDENT@[298; 302) "attr" | ||
259 | R_BRACK@[302; 303) "]" | ||
260 | WHITESPACE@[303; 304) " " | ||
261 | SELF_PARAM@[304; 316) | ||
262 | AMP@[304; 305) "&" | ||
263 | LIFETIME@[305; 307) "\'a" | ||
264 | WHITESPACE@[307; 308) " " | ||
265 | MUT_KW@[308; 311) "mut" | ||
266 | WHITESPACE@[311; 312) " " | ||
267 | SELF_KW@[312; 316) "self" | ||
268 | R_PAREN@[316; 317) ")" | ||
269 | WHITESPACE@[317; 318) " " | ||
270 | BLOCK@[318; 320) | ||
271 | L_CURLY@[318; 319) "{" | ||
272 | R_CURLY@[319; 320) "}" | ||
273 | WHITESPACE@[320; 321) "\n" | ||
274 | R_CURLY@[321; 322) "}" | ||
275 | WHITESPACE@[322; 323) "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rs b/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rs index 6a170d5ac..077216dae 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rs | |||
@@ -1,4 +1,6 @@ | |||
1 | impl S { | 1 | impl S { |
2 | fn a(self: &Self) {} | 2 | fn a(self: &Self) {} |
3 | fn b(mut self: Box<Self>) {} | 3 | fn b(mut self: Box<Self>) {} |
4 | fn c(#[attr] self: Self) {} | ||
5 | fn d(#[attr] self: Rc<Self>) {} | ||
4 | } | 6 | } |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.txt b/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.txt index 67d0de0f0..ca49bcc26 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 69) | 1 | SOURCE_FILE@[0; 137) |
2 | IMPL_BLOCK@[0; 68) | 2 | IMPL_BLOCK@[0; 136) |
3 | IMPL_KW@[0; 4) "impl" | 3 | IMPL_KW@[0; 4) "impl" |
4 | WHITESPACE@[4; 5) " " | 4 | WHITESPACE@[4; 5) " " |
5 | PATH_TYPE@[5; 6) | 5 | PATH_TYPE@[5; 6) |
@@ -8,7 +8,7 @@ SOURCE_FILE@[0; 69) | |||
8 | NAME_REF@[5; 6) | 8 | NAME_REF@[5; 6) |
9 | IDENT@[5; 6) "S" | 9 | IDENT@[5; 6) "S" |
10 | WHITESPACE@[6; 7) " " | 10 | WHITESPACE@[6; 7) " " |
11 | ITEM_LIST@[7; 68) | 11 | ITEM_LIST@[7; 136) |
12 | L_CURLY@[7; 8) "{" | 12 | L_CURLY@[7; 8) "{" |
13 | WHITESPACE@[8; 13) "\n " | 13 | WHITESPACE@[8; 13) "\n " |
14 | FN_DEF@[13; 33) | 14 | FN_DEF@[13; 33) |
@@ -67,6 +67,73 @@ SOURCE_FILE@[0; 69) | |||
67 | BLOCK@[64; 66) | 67 | BLOCK@[64; 66) |
68 | L_CURLY@[64; 65) "{" | 68 | L_CURLY@[64; 65) "{" |
69 | R_CURLY@[65; 66) "}" | 69 | R_CURLY@[65; 66) "}" |
70 | WHITESPACE@[66; 67) "\n" | 70 | WHITESPACE@[66; 71) "\n " |
71 | R_CURLY@[67; 68) "}" | 71 | FN_DEF@[71; 98) |
72 | WHITESPACE@[68; 69) "\n" | 72 | FN_KW@[71; 73) "fn" |
73 | WHITESPACE@[73; 74) " " | ||
74 | NAME@[74; 75) | ||
75 | IDENT@[74; 75) "c" | ||
76 | PARAM_LIST@[75; 95) | ||
77 | L_PAREN@[75; 76) "(" | ||
78 | ATTR@[76; 83) | ||
79 | POUND@[76; 77) "#" | ||
80 | TOKEN_TREE@[77; 83) | ||
81 | L_BRACK@[77; 78) "[" | ||
82 | IDENT@[78; 82) "attr" | ||
83 | R_BRACK@[82; 83) "]" | ||
84 | WHITESPACE@[83; 84) " " | ||
85 | SELF_PARAM@[84; 94) | ||
86 | SELF_KW@[84; 88) "self" | ||
87 | COLON@[88; 89) ":" | ||
88 | WHITESPACE@[89; 90) " " | ||
89 | PATH_TYPE@[90; 94) | ||
90 | PATH@[90; 94) | ||
91 | PATH_SEGMENT@[90; 94) | ||
92 | NAME_REF@[90; 94) | ||
93 | IDENT@[90; 94) "Self" | ||
94 | R_PAREN@[94; 95) ")" | ||
95 | WHITESPACE@[95; 96) " " | ||
96 | BLOCK@[96; 98) | ||
97 | L_CURLY@[96; 97) "{" | ||
98 | R_CURLY@[97; 98) "}" | ||
99 | WHITESPACE@[98; 103) "\n " | ||
100 | FN_DEF@[103; 134) | ||
101 | FN_KW@[103; 105) "fn" | ||
102 | WHITESPACE@[105; 106) " " | ||
103 | NAME@[106; 107) | ||
104 | IDENT@[106; 107) "d" | ||
105 | PARAM_LIST@[107; 131) | ||
106 | L_PAREN@[107; 108) "(" | ||
107 | ATTR@[108; 115) | ||
108 | POUND@[108; 109) "#" | ||
109 | TOKEN_TREE@[109; 115) | ||
110 | L_BRACK@[109; 110) "[" | ||
111 | IDENT@[110; 114) "attr" | ||
112 | R_BRACK@[114; 115) "]" | ||
113 | WHITESPACE@[115; 116) " " | ||
114 | SELF_PARAM@[116; 130) | ||
115 | SELF_KW@[116; 120) "self" | ||
116 | COLON@[120; 121) ":" | ||
117 | WHITESPACE@[121; 122) " " | ||
118 | PATH_TYPE@[122; 130) | ||
119 | PATH@[122; 130) | ||
120 | PATH_SEGMENT@[122; 130) | ||
121 | NAME_REF@[122; 124) | ||
122 | IDENT@[122; 124) "Rc" | ||
123 | TYPE_ARG_LIST@[124; 130) | ||
124 | L_ANGLE@[124; 125) "<" | ||
125 | TYPE_ARG@[125; 129) | ||
126 | PATH_TYPE@[125; 129) | ||
127 | PATH@[125; 129) | ||
128 | PATH_SEGMENT@[125; 129) | ||
129 | NAME_REF@[125; 129) | ||
130 | IDENT@[125; 129) "Self" | ||
131 | R_ANGLE@[129; 130) ">" | ||
132 | R_PAREN@[130; 131) ")" | ||
133 | WHITESPACE@[131; 132) " " | ||
134 | BLOCK@[132; 134) | ||
135 | L_CURLY@[132; 133) "{" | ||
136 | R_CURLY@[133; 134) "}" | ||
137 | WHITESPACE@[134; 135) "\n" | ||
138 | R_CURLY@[135; 136) "}" | ||
139 | WHITESPACE@[136; 137) "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rs b/crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rs index 9b93442c0..9833dd8f1 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rs | |||
@@ -1 +1,2 @@ | |||
1 | fn foo<F: FnMut(&mut Foo<'a>)>(){} | 1 | fn foo<F: FnMut(&mut Foo<'a>)>(){} |
2 | fn foo<F: FnMut(#[attr] &mut Foo<'a>)>(){} | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.txt b/crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.txt index f85d6a4bc..0b377dfd4 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.txt | |||
@@ -1,4 +1,4 @@ | |||
1 | SOURCE_FILE@[0; 35) | 1 | SOURCE_FILE@[0; 78) |
2 | FN_DEF@[0; 34) | 2 | FN_DEF@[0; 34) |
3 | FN_KW@[0; 2) "fn" | 3 | FN_KW@[0; 2) "fn" |
4 | WHITESPACE@[2; 3) " " | 4 | WHITESPACE@[2; 3) " " |
@@ -44,3 +44,55 @@ SOURCE_FILE@[0; 35) | |||
44 | L_CURLY@[32; 33) "{" | 44 | L_CURLY@[32; 33) "{" |
45 | R_CURLY@[33; 34) "}" | 45 | R_CURLY@[33; 34) "}" |
46 | WHITESPACE@[34; 35) "\n" | 46 | WHITESPACE@[34; 35) "\n" |
47 | FN_DEF@[35; 77) | ||
48 | FN_KW@[35; 37) "fn" | ||
49 | WHITESPACE@[37; 38) " " | ||
50 | NAME@[38; 41) | ||
51 | IDENT@[38; 41) "foo" | ||
52 | TYPE_PARAM_LIST@[41; 73) | ||
53 | L_ANGLE@[41; 42) "<" | ||
54 | TYPE_PARAM@[42; 72) | ||
55 | NAME@[42; 43) | ||
56 | IDENT@[42; 43) "F" | ||
57 | COLON@[43; 44) ":" | ||
58 | WHITESPACE@[44; 45) " " | ||
59 | TYPE_BOUND_LIST@[45; 72) | ||
60 | TYPE_BOUND@[45; 72) | ||
61 | PATH_TYPE@[45; 72) | ||
62 | PATH@[45; 72) | ||
63 | PATH_SEGMENT@[45; 72) | ||
64 | NAME_REF@[45; 50) | ||
65 | IDENT@[45; 50) "FnMut" | ||
66 | PARAM_LIST@[50; 72) | ||
67 | L_PAREN@[50; 51) "(" | ||
68 | ATTR@[51; 58) | ||
69 | POUND@[51; 52) "#" | ||
70 | TOKEN_TREE@[52; 58) | ||
71 | L_BRACK@[52; 53) "[" | ||
72 | IDENT@[53; 57) "attr" | ||
73 | R_BRACK@[57; 58) "]" | ||
74 | WHITESPACE@[58; 59) " " | ||
75 | PARAM@[59; 71) | ||
76 | REFERENCE_TYPE@[59; 71) | ||
77 | AMP@[59; 60) "&" | ||
78 | MUT_KW@[60; 63) "mut" | ||
79 | WHITESPACE@[63; 64) " " | ||
80 | PATH_TYPE@[64; 71) | ||
81 | PATH@[64; 71) | ||
82 | PATH_SEGMENT@[64; 71) | ||
83 | NAME_REF@[64; 67) | ||
84 | IDENT@[64; 67) "Foo" | ||
85 | TYPE_ARG_LIST@[67; 71) | ||
86 | L_ANGLE@[67; 68) "<" | ||
87 | LIFETIME_ARG@[68; 70) | ||
88 | LIFETIME@[68; 70) "\'a" | ||
89 | R_ANGLE@[70; 71) ">" | ||
90 | R_PAREN@[71; 72) ")" | ||
91 | R_ANGLE@[72; 73) ">" | ||
92 | PARAM_LIST@[73; 75) | ||
93 | L_PAREN@[73; 74) "(" | ||
94 | R_PAREN@[74; 75) ")" | ||
95 | BLOCK@[75; 77) | ||
96 | L_CURLY@[75; 76) "{" | ||
97 | R_CURLY@[76; 77) "}" | ||
98 | WHITESPACE@[77; 78) "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0099_param_list.rs b/crates/ra_syntax/test_data/parser/inline/ok/0099_param_list.rs index 9d55bedbb..83d870ba7 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0099_param_list.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0099_param_list.rs | |||
@@ -2,3 +2,5 @@ fn a() {} | |||
2 | fn b(x: i32) {} | 2 | fn b(x: i32) {} |
3 | fn c(x: i32, ) {} | 3 | fn c(x: i32, ) {} |
4 | fn d(x: i32, y: ()) {} | 4 | fn d(x: i32, y: ()) {} |
5 | fn g1(#[attr1] #[attr2] pat: Type) {} | ||
6 | fn g2(#[attr1] x: u8) {} | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0099_param_list.txt b/crates/ra_syntax/test_data/parser/inline/ok/0099_param_list.txt index 80d636819..a9c63fa93 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0099_param_list.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0099_param_list.txt | |||
@@ -1,4 +1,4 @@ | |||
1 | SOURCE_FILE@[0; 67) | 1 | SOURCE_FILE@[0; 130) |
2 | FN_DEF@[0; 9) | 2 | FN_DEF@[0; 9) |
3 | FN_KW@[0; 2) "fn" | 3 | FN_KW@[0; 2) "fn" |
4 | WHITESPACE@[2; 3) " " | 4 | WHITESPACE@[2; 3) " " |
@@ -97,3 +97,72 @@ SOURCE_FILE@[0; 67) | |||
97 | L_CURLY@[64; 65) "{" | 97 | L_CURLY@[64; 65) "{" |
98 | R_CURLY@[65; 66) "}" | 98 | R_CURLY@[65; 66) "}" |
99 | WHITESPACE@[66; 67) "\n" | 99 | WHITESPACE@[66; 67) "\n" |
100 | FN_DEF@[67; 104) | ||
101 | FN_KW@[67; 69) "fn" | ||
102 | WHITESPACE@[69; 70) " " | ||
103 | NAME@[70; 72) | ||
104 | IDENT@[70; 72) "g1" | ||
105 | PARAM_LIST@[72; 101) | ||
106 | L_PAREN@[72; 73) "(" | ||
107 | ATTR@[73; 81) | ||
108 | POUND@[73; 74) "#" | ||
109 | TOKEN_TREE@[74; 81) | ||
110 | L_BRACK@[74; 75) "[" | ||
111 | IDENT@[75; 80) "attr1" | ||
112 | R_BRACK@[80; 81) "]" | ||
113 | WHITESPACE@[81; 82) " " | ||
114 | ATTR@[82; 90) | ||
115 | POUND@[82; 83) "#" | ||
116 | TOKEN_TREE@[83; 90) | ||
117 | L_BRACK@[83; 84) "[" | ||
118 | IDENT@[84; 89) "attr2" | ||
119 | R_BRACK@[89; 90) "]" | ||
120 | WHITESPACE@[90; 91) " " | ||
121 | PARAM@[91; 100) | ||
122 | BIND_PAT@[91; 94) | ||
123 | NAME@[91; 94) | ||
124 | IDENT@[91; 94) "pat" | ||
125 | COLON@[94; 95) ":" | ||
126 | WHITESPACE@[95; 96) " " | ||
127 | PATH_TYPE@[96; 100) | ||
128 | PATH@[96; 100) | ||
129 | PATH_SEGMENT@[96; 100) | ||
130 | NAME_REF@[96; 100) | ||
131 | IDENT@[96; 100) "Type" | ||
132 | R_PAREN@[100; 101) ")" | ||
133 | WHITESPACE@[101; 102) " " | ||
134 | BLOCK@[102; 104) | ||
135 | L_CURLY@[102; 103) "{" | ||
136 | R_CURLY@[103; 104) "}" | ||
137 | WHITESPACE@[104; 105) "\n" | ||
138 | FN_DEF@[105; 129) | ||
139 | FN_KW@[105; 107) "fn" | ||
140 | WHITESPACE@[107; 108) " " | ||
141 | NAME@[108; 110) | ||
142 | IDENT@[108; 110) "g2" | ||
143 | PARAM_LIST@[110; 126) | ||
144 | L_PAREN@[110; 111) "(" | ||
145 | ATTR@[111; 119) | ||
146 | POUND@[111; 112) "#" | ||
147 | TOKEN_TREE@[112; 119) | ||
148 | L_BRACK@[112; 113) "[" | ||
149 | IDENT@[113; 118) "attr1" | ||
150 | R_BRACK@[118; 119) "]" | ||
151 | WHITESPACE@[119; 120) " " | ||
152 | PARAM@[120; 125) | ||
153 | BIND_PAT@[120; 121) | ||
154 | NAME@[120; 121) | ||
155 | IDENT@[120; 121) "x" | ||
156 | COLON@[121; 122) ":" | ||
157 | WHITESPACE@[122; 123) " " | ||
158 | PATH_TYPE@[123; 125) | ||
159 | PATH@[123; 125) | ||
160 | PATH_SEGMENT@[123; 125) | ||
161 | NAME_REF@[123; 125) | ||
162 | IDENT@[123; 125) "u8" | ||
163 | R_PAREN@[125; 126) ")" | ||
164 | WHITESPACE@[126; 127) " " | ||
165 | BLOCK@[127; 129) | ||
166 | L_CURLY@[127; 128) "{" | ||
167 | R_CURLY@[128; 129) "}" | ||
168 | WHITESPACE@[129; 130) "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0116_trait_fn_placeholder_parameter.rs b/crates/ra_syntax/test_data/parser/inline/ok/0116_trait_fn_placeholder_parameter.rs index 472cb8803..90c4dcd2d 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0116_trait_fn_placeholder_parameter.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0116_trait_fn_placeholder_parameter.rs | |||
@@ -1,3 +1,4 @@ | |||
1 | trait Foo { | 1 | trait Foo { |
2 | fn bar(_: u64, mut x: i32); | 2 | fn bar(_: u64, mut x: i32); |
3 | fn bar(#[attr] _: u64, #[attr] mut x: i32); | ||
3 | } | 4 | } |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0116_trait_fn_placeholder_parameter.txt b/crates/ra_syntax/test_data/parser/inline/ok/0116_trait_fn_placeholder_parameter.txt index 158236c5a..b5c6e0a2a 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0116_trait_fn_placeholder_parameter.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0116_trait_fn_placeholder_parameter.txt | |||
@@ -1,11 +1,11 @@ | |||
1 | SOURCE_FILE@[0; 46) | 1 | SOURCE_FILE@[0; 94) |
2 | TRAIT_DEF@[0; 45) | 2 | TRAIT_DEF@[0; 93) |
3 | TRAIT_KW@[0; 5) "trait" | 3 | TRAIT_KW@[0; 5) "trait" |
4 | WHITESPACE@[5; 6) " " | 4 | WHITESPACE@[5; 6) " " |
5 | NAME@[6; 9) | 5 | NAME@[6; 9) |
6 | IDENT@[6; 9) "Foo" | 6 | IDENT@[6; 9) "Foo" |
7 | WHITESPACE@[9; 10) " " | 7 | WHITESPACE@[9; 10) " " |
8 | ITEM_LIST@[10; 45) | 8 | ITEM_LIST@[10; 93) |
9 | L_CURLY@[10; 11) "{" | 9 | L_CURLY@[10; 11) "{" |
10 | WHITESPACE@[11; 16) "\n " | 10 | WHITESPACE@[11; 16) "\n " |
11 | FN_DEF@[16; 43) | 11 | FN_DEF@[16; 43) |
@@ -42,6 +42,55 @@ SOURCE_FILE@[0; 46) | |||
42 | IDENT@[38; 41) "i32" | 42 | IDENT@[38; 41) "i32" |
43 | R_PAREN@[41; 42) ")" | 43 | R_PAREN@[41; 42) ")" |
44 | SEMI@[42; 43) ";" | 44 | SEMI@[42; 43) ";" |
45 | WHITESPACE@[43; 44) "\n" | 45 | WHITESPACE@[43; 48) "\n " |
46 | R_CURLY@[44; 45) "}" | 46 | FN_DEF@[48; 91) |
47 | WHITESPACE@[45; 46) "\n" | 47 | FN_KW@[48; 50) "fn" |
48 | WHITESPACE@[50; 51) " " | ||
49 | NAME@[51; 54) | ||
50 | IDENT@[51; 54) "bar" | ||
51 | PARAM_LIST@[54; 90) | ||
52 | L_PAREN@[54; 55) "(" | ||
53 | ATTR@[55; 62) | ||
54 | POUND@[55; 56) "#" | ||
55 | TOKEN_TREE@[56; 62) | ||
56 | L_BRACK@[56; 57) "[" | ||
57 | IDENT@[57; 61) "attr" | ||
58 | R_BRACK@[61; 62) "]" | ||
59 | WHITESPACE@[62; 63) " " | ||
60 | PARAM@[63; 69) | ||
61 | PLACEHOLDER_PAT@[63; 64) | ||
62 | UNDERSCORE@[63; 64) "_" | ||
63 | COLON@[64; 65) ":" | ||
64 | WHITESPACE@[65; 66) " " | ||
65 | PATH_TYPE@[66; 69) | ||
66 | PATH@[66; 69) | ||
67 | PATH_SEGMENT@[66; 69) | ||
68 | NAME_REF@[66; 69) | ||
69 | IDENT@[66; 69) "u64" | ||
70 | COMMA@[69; 70) "," | ||
71 | WHITESPACE@[70; 71) " " | ||
72 | ATTR@[71; 78) | ||
73 | POUND@[71; 72) "#" | ||
74 | TOKEN_TREE@[72; 78) | ||
75 | L_BRACK@[72; 73) "[" | ||
76 | IDENT@[73; 77) "attr" | ||
77 | R_BRACK@[77; 78) "]" | ||
78 | WHITESPACE@[78; 79) " " | ||
79 | PARAM@[79; 89) | ||
80 | BIND_PAT@[79; 84) | ||
81 | MUT_KW@[79; 82) "mut" | ||
82 | WHITESPACE@[82; 83) " " | ||
83 | NAME@[83; 84) | ||
84 | IDENT@[83; 84) "x" | ||
85 | COLON@[84; 85) ":" | ||
86 | WHITESPACE@[85; 86) " " | ||
87 | PATH_TYPE@[86; 89) | ||
88 | PATH@[86; 89) | ||
89 | PATH_SEGMENT@[86; 89) | ||
90 | NAME_REF@[86; 89) | ||
91 | IDENT@[86; 89) "i32" | ||
92 | R_PAREN@[89; 90) ")" | ||
93 | SEMI@[90; 91) ";" | ||
94 | WHITESPACE@[91; 92) "\n" | ||
95 | R_CURLY@[92; 93) "}" | ||
96 | WHITESPACE@[93; 94) "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.rs b/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.rs index c59addaf4..8583ede05 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.rs | |||
@@ -1 +1,2 @@ | |||
1 | extern "C" { fn printf(format: *const i8, ...) -> i32; } | 1 | extern "C" { fn printf(format: *const i8, ...) -> i32; } |
2 | extern "C" { fn printf(#[attr] format: *const i8, ...) -> i32; } | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.txt b/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.txt index 836e8e55b..164ead2d8 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.txt | |||
@@ -1,4 +1,4 @@ | |||
1 | SOURCE_FILE@[0; 57) | 1 | SOURCE_FILE@[0; 122) |
2 | EXTERN_BLOCK@[0; 56) | 2 | EXTERN_BLOCK@[0; 56) |
3 | ABI@[0; 10) | 3 | ABI@[0; 10) |
4 | EXTERN_KW@[0; 6) "extern" | 4 | EXTERN_KW@[0; 6) "extern" |
@@ -47,3 +47,58 @@ SOURCE_FILE@[0; 57) | |||
47 | WHITESPACE@[54; 55) " " | 47 | WHITESPACE@[54; 55) " " |
48 | R_CURLY@[55; 56) "}" | 48 | R_CURLY@[55; 56) "}" |
49 | WHITESPACE@[56; 57) "\n" | 49 | WHITESPACE@[56; 57) "\n" |
50 | EXTERN_BLOCK@[57; 121) | ||
51 | ABI@[57; 67) | ||
52 | EXTERN_KW@[57; 63) "extern" | ||
53 | WHITESPACE@[63; 64) " " | ||
54 | STRING@[64; 67) "\"C\"" | ||
55 | WHITESPACE@[67; 68) " " | ||
56 | EXTERN_ITEM_LIST@[68; 121) | ||
57 | L_CURLY@[68; 69) "{" | ||
58 | WHITESPACE@[69; 70) " " | ||
59 | FN_DEF@[70; 119) | ||
60 | FN_KW@[70; 72) "fn" | ||
61 | WHITESPACE@[72; 73) " " | ||
62 | NAME@[73; 79) | ||
63 | IDENT@[73; 79) "printf" | ||
64 | PARAM_LIST@[79; 111) | ||
65 | L_PAREN@[79; 80) "(" | ||
66 | ATTR@[80; 87) | ||
67 | POUND@[80; 81) "#" | ||
68 | TOKEN_TREE@[81; 87) | ||
69 | L_BRACK@[81; 82) "[" | ||
70 | IDENT@[82; 86) "attr" | ||
71 | R_BRACK@[86; 87) "]" | ||
72 | WHITESPACE@[87; 88) " " | ||
73 | PARAM@[88; 105) | ||
74 | BIND_PAT@[88; 94) | ||
75 | NAME@[88; 94) | ||
76 | IDENT@[88; 94) "format" | ||
77 | COLON@[94; 95) ":" | ||
78 | WHITESPACE@[95; 96) " " | ||
79 | POINTER_TYPE@[96; 105) | ||
80 | STAR@[96; 97) "*" | ||
81 | CONST_KW@[97; 102) "const" | ||
82 | WHITESPACE@[102; 103) " " | ||
83 | PATH_TYPE@[103; 105) | ||
84 | PATH@[103; 105) | ||
85 | PATH_SEGMENT@[103; 105) | ||
86 | NAME_REF@[103; 105) | ||
87 | IDENT@[103; 105) "i8" | ||
88 | COMMA@[105; 106) "," | ||
89 | WHITESPACE@[106; 107) " " | ||
90 | DOTDOTDOT@[107; 110) "..." | ||
91 | R_PAREN@[110; 111) ")" | ||
92 | WHITESPACE@[111; 112) " " | ||
93 | RET_TYPE@[112; 118) | ||
94 | THIN_ARROW@[112; 114) "->" | ||
95 | WHITESPACE@[114; 115) " " | ||
96 | PATH_TYPE@[115; 118) | ||
97 | PATH@[115; 118) | ||
98 | PATH_SEGMENT@[115; 118) | ||
99 | NAME_REF@[115; 118) | ||
100 | IDENT@[115; 118) "i32" | ||
101 | SEMI@[118; 119) ";" | ||
102 | WHITESPACE@[119; 120) " " | ||
103 | R_CURLY@[120; 121) "}" | ||
104 | WHITESPACE@[121; 122) "\n" | ||