diff options
Diffstat (limited to 'tests/data/parser')
-rw-r--r-- | tests/data/parser/err/0012_broken_lambda.rs | 12 | ||||
-rw-r--r-- | tests/data/parser/err/0012_broken_lambda.txt | 387 |
2 files changed, 399 insertions, 0 deletions
diff --git a/tests/data/parser/err/0012_broken_lambda.rs b/tests/data/parser/err/0012_broken_lambda.rs new file mode 100644 index 000000000..ad0d8eb4c --- /dev/null +++ b/tests/data/parser/err/0012_broken_lambda.rs | |||
@@ -0,0 +1,12 @@ | |||
1 | pub(super) fn process<'a, S: Sink<'a>>(builder: &mut S, tokens: &[Token], events: Vec<Event>) { | ||
2 | let mut next_tok_idx = 0; | ||
3 | let eat_ws = |idx: &mut usize, &mut | { | ||
4 | while let Some(token) = tokens.get(*idx) { | ||
5 | if !token.kind.is_trivia() { | ||
6 | break; | ||
7 | } | ||
8 | builder.leaf(token.kind, token.len); | ||
9 | *idx += 1 | ||
10 | } | ||
11 | }; | ||
12 | } | ||
diff --git a/tests/data/parser/err/0012_broken_lambda.txt b/tests/data/parser/err/0012_broken_lambda.txt new file mode 100644 index 000000000..f484419a2 --- /dev/null +++ b/tests/data/parser/err/0012_broken_lambda.txt | |||
@@ -0,0 +1,387 @@ | |||
1 | FILE@[0; 389) | ||
2 | FN_ITEM@[0; 389) | ||
3 | VISIBILITY@[0; 10) | ||
4 | PUB_KW@[0; 3) | ||
5 | L_PAREN@[3; 4) | ||
6 | SUPER_KW@[4; 9) | ||
7 | R_PAREN@[9; 10) | ||
8 | WHITESPACE@[10; 11) | ||
9 | FN_KW@[11; 13) | ||
10 | WHITESPACE@[13; 14) | ||
11 | NAME@[14; 21) | ||
12 | IDENT@[14; 21) "process" | ||
13 | TYPE_PARAM_LIST@[21; 38) | ||
14 | L_ANGLE@[21; 22) | ||
15 | LIFETIME_PARAM@[22; 24) | ||
16 | LIFETIME@[22; 24) "'a" | ||
17 | COMMA@[24; 25) | ||
18 | WHITESPACE@[25; 26) | ||
19 | TYPE_PARAM@[26; 37) | ||
20 | NAME@[26; 27) | ||
21 | IDENT@[26; 27) "S" | ||
22 | COLON@[27; 28) | ||
23 | WHITESPACE@[28; 29) | ||
24 | PATH@[29; 37) | ||
25 | PATH_SEGMENT@[29; 37) | ||
26 | NAME_REF@[29; 33) | ||
27 | IDENT@[29; 33) "Sink" | ||
28 | TYPE_ARG_LIST@[33; 37) | ||
29 | L_ANGLE@[33; 34) | ||
30 | LIFETIME_ARG@[34; 36) | ||
31 | LIFETIME@[34; 36) "'a" | ||
32 | R_ANGLE@[36; 37) | ||
33 | R_ANGLE@[37; 38) | ||
34 | PARAM_LIST@[38; 93) | ||
35 | L_PAREN@[38; 39) | ||
36 | PARAM@[39; 54) | ||
37 | BIND_PAT@[39; 46) | ||
38 | NAME@[39; 46) | ||
39 | IDENT@[39; 46) "builder" | ||
40 | COLON@[46; 47) | ||
41 | WHITESPACE@[47; 48) | ||
42 | REFERENCE_TYPE@[48; 54) | ||
43 | AMP@[48; 49) | ||
44 | MUT_KW@[49; 52) | ||
45 | WHITESPACE@[52; 53) | ||
46 | PATH_TYPE@[53; 54) | ||
47 | PATH@[53; 54) | ||
48 | PATH_SEGMENT@[53; 54) | ||
49 | NAME_REF@[53; 54) | ||
50 | IDENT@[53; 54) "S" | ||
51 | COMMA@[54; 55) | ||
52 | WHITESPACE@[55; 56) | ||
53 | PARAM@[56; 72) | ||
54 | BIND_PAT@[56; 62) | ||
55 | NAME@[56; 62) | ||
56 | IDENT@[56; 62) "tokens" | ||
57 | COLON@[62; 63) | ||
58 | WHITESPACE@[63; 64) | ||
59 | REFERENCE_TYPE@[64; 72) | ||
60 | AMP@[64; 65) | ||
61 | SLICE_TYPE@[65; 72) | ||
62 | L_BRACK@[65; 66) | ||
63 | PATH_TYPE@[66; 71) | ||
64 | PATH@[66; 71) | ||
65 | PATH_SEGMENT@[66; 71) | ||
66 | NAME_REF@[66; 71) | ||
67 | IDENT@[66; 71) "Token" | ||
68 | R_BRACK@[71; 72) | ||
69 | COMMA@[72; 73) | ||
70 | WHITESPACE@[73; 74) | ||
71 | PARAM@[74; 92) | ||
72 | BIND_PAT@[74; 80) | ||
73 | NAME@[74; 80) | ||
74 | IDENT@[74; 80) "events" | ||
75 | COLON@[80; 81) | ||
76 | WHITESPACE@[81; 82) | ||
77 | PATH_TYPE@[82; 92) | ||
78 | PATH@[82; 92) | ||
79 | PATH_SEGMENT@[82; 92) | ||
80 | NAME_REF@[82; 85) | ||
81 | IDENT@[82; 85) "Vec" | ||
82 | TYPE_ARG_LIST@[85; 92) | ||
83 | L_ANGLE@[85; 86) | ||
84 | TYPE_ARG@[86; 91) | ||
85 | PATH_TYPE@[86; 91) | ||
86 | PATH@[86; 91) | ||
87 | PATH_SEGMENT@[86; 91) | ||
88 | NAME_REF@[86; 91) | ||
89 | IDENT@[86; 91) "Event" | ||
90 | R_ANGLE@[91; 92) | ||
91 | R_PAREN@[92; 93) | ||
92 | WHITESPACE@[93; 94) | ||
93 | BLOCK_EXPR@[94; 389) | ||
94 | L_CURLY@[94; 95) | ||
95 | WHITESPACE@[95; 100) | ||
96 | LET_STMT@[100; 125) | ||
97 | LET_KW@[100; 103) | ||
98 | WHITESPACE@[103; 104) | ||
99 | BIND_PAT@[104; 120) | ||
100 | MUT_KW@[104; 107) | ||
101 | WHITESPACE@[107; 108) | ||
102 | NAME@[108; 120) | ||
103 | IDENT@[108; 120) "next_tok_idx" | ||
104 | WHITESPACE@[120; 121) | ||
105 | EQ@[121; 122) | ||
106 | WHITESPACE@[122; 123) | ||
107 | LITERAL@[123; 124) | ||
108 | INT_NUMBER@[123; 124) "0" | ||
109 | SEMI@[124; 125) | ||
110 | WHITESPACE@[125; 130) | ||
111 | LET_STMT@[130; 389) | ||
112 | LET_KW@[130; 133) | ||
113 | WHITESPACE@[133; 134) | ||
114 | BIND_PAT@[134; 140) | ||
115 | NAME@[134; 140) | ||
116 | IDENT@[134; 140) "eat_ws" | ||
117 | WHITESPACE@[140; 141) | ||
118 | EQ@[141; 142) | ||
119 | WHITESPACE@[142; 143) | ||
120 | LAMBDA_EXPR@[143; 389) | ||
121 | PARAM_LIST@[143; 388) | ||
122 | PIPE@[143; 144) | ||
123 | PARAM@[144; 159) | ||
124 | BIND_PAT@[144; 147) | ||
125 | NAME@[144; 147) | ||
126 | IDENT@[144; 147) "idx" | ||
127 | COLON@[147; 148) | ||
128 | WHITESPACE@[148; 149) | ||
129 | REFERENCE_TYPE@[149; 159) | ||
130 | AMP@[149; 150) | ||
131 | MUT_KW@[150; 153) | ||
132 | WHITESPACE@[153; 154) | ||
133 | PATH_TYPE@[154; 159) | ||
134 | PATH@[154; 159) | ||
135 | PATH_SEGMENT@[154; 159) | ||
136 | NAME_REF@[154; 159) | ||
137 | IDENT@[154; 159) "usize" | ||
138 | COMMA@[159; 160) | ||
139 | WHITESPACE@[160; 161) | ||
140 | PARAM@[161; 167) | ||
141 | REF_PAT@[161; 167) | ||
142 | AMP@[161; 162) | ||
143 | MUT_KW@[162; 165) | ||
144 | WHITESPACE@[165; 166) | ||
145 | err: `expected pattern` | ||
146 | ERROR@[166; 167) | ||
147 | PIPE@[166; 167) | ||
148 | err: `expected COMMA` | ||
149 | WHITESPACE@[167; 168) | ||
150 | err: `expected pattern` | ||
151 | PARAM@[168; 169) | ||
152 | ERROR@[168; 169) | ||
153 | L_CURLY@[168; 169) | ||
154 | err: `expected COMMA` | ||
155 | WHITESPACE@[169; 178) | ||
156 | err: `expected pattern` | ||
157 | PARAM@[178; 183) | ||
158 | ERROR@[178; 183) | ||
159 | WHILE_KW@[178; 183) | ||
160 | err: `expected COMMA` | ||
161 | WHITESPACE@[183; 184) | ||
162 | err: `expected pattern` | ||
163 | PARAM@[184; 187) | ||
164 | ERROR@[184; 187) | ||
165 | LET_KW@[184; 187) | ||
166 | err: `expected COMMA` | ||
167 | WHITESPACE@[187; 188) | ||
168 | PARAM@[188; 199) | ||
169 | TUPLE_STRUCT_PAT@[188; 199) | ||
170 | PATH@[188; 192) | ||
171 | PATH_SEGMENT@[188; 192) | ||
172 | NAME_REF@[188; 192) | ||
173 | IDENT@[188; 192) "Some" | ||
174 | L_PAREN@[192; 193) | ||
175 | BIND_PAT@[193; 198) | ||
176 | NAME@[193; 198) | ||
177 | IDENT@[193; 198) "token" | ||
178 | R_PAREN@[198; 199) | ||
179 | err: `expected COMMA` | ||
180 | WHITESPACE@[199; 200) | ||
181 | err: `expected pattern` | ||
182 | PARAM@[200; 201) | ||
183 | ERROR@[200; 201) | ||
184 | EQ@[200; 201) | ||
185 | err: `expected COMMA` | ||
186 | WHITESPACE@[201; 202) | ||
187 | PARAM@[202; 208) | ||
188 | BIND_PAT@[202; 208) | ||
189 | NAME@[202; 208) | ||
190 | IDENT@[202; 208) "tokens" | ||
191 | err: `expected COMMA` | ||
192 | err: `expected pattern` | ||
193 | PARAM@[208; 209) | ||
194 | ERROR@[208; 209) | ||
195 | DOT@[208; 209) | ||
196 | err: `expected COMMA` | ||
197 | PARAM@[209; 218) | ||
198 | TUPLE_STRUCT_PAT@[209; 218) | ||
199 | PATH@[209; 212) | ||
200 | PATH_SEGMENT@[209; 212) | ||
201 | NAME_REF@[209; 212) | ||
202 | IDENT@[209; 212) "get" | ||
203 | L_PAREN@[212; 213) | ||
204 | err: `expected pattern` | ||
205 | ERROR@[213; 214) | ||
206 | STAR@[213; 214) | ||
207 | err: `expected COMMA` | ||
208 | BIND_PAT@[214; 217) | ||
209 | NAME@[214; 217) | ||
210 | IDENT@[214; 217) "idx" | ||
211 | R_PAREN@[217; 218) | ||
212 | err: `expected COMMA` | ||
213 | WHITESPACE@[218; 219) | ||
214 | err: `expected pattern` | ||
215 | PARAM@[219; 220) | ||
216 | ERROR@[219; 220) | ||
217 | L_CURLY@[219; 220) | ||
218 | err: `expected COMMA` | ||
219 | WHITESPACE@[220; 233) | ||
220 | err: `expected pattern` | ||
221 | PARAM@[233; 235) | ||
222 | ERROR@[233; 235) | ||
223 | IF_KW@[233; 235) | ||
224 | err: `expected COMMA` | ||
225 | WHITESPACE@[235; 236) | ||
226 | err: `expected pattern` | ||
227 | PARAM@[236; 237) | ||
228 | ERROR@[236; 237) | ||
229 | EXCL@[236; 237) | ||
230 | err: `expected COMMA` | ||
231 | PARAM@[237; 242) | ||
232 | BIND_PAT@[237; 242) | ||
233 | NAME@[237; 242) | ||
234 | IDENT@[237; 242) "token" | ||
235 | err: `expected COMMA` | ||
236 | err: `expected pattern` | ||
237 | PARAM@[242; 243) | ||
238 | ERROR@[242; 243) | ||
239 | DOT@[242; 243) | ||
240 | err: `expected COMMA` | ||
241 | PARAM@[243; 247) | ||
242 | BIND_PAT@[243; 247) | ||
243 | NAME@[243; 247) | ||
244 | IDENT@[243; 247) "kind" | ||
245 | err: `expected COMMA` | ||
246 | err: `expected pattern` | ||
247 | PARAM@[247; 248) | ||
248 | ERROR@[247; 248) | ||
249 | DOT@[247; 248) | ||
250 | err: `expected COMMA` | ||
251 | PARAM@[248; 259) | ||
252 | TUPLE_STRUCT_PAT@[248; 259) | ||
253 | PATH@[248; 257) | ||
254 | PATH_SEGMENT@[248; 257) | ||
255 | NAME_REF@[248; 257) | ||
256 | IDENT@[248; 257) "is_trivia" | ||
257 | L_PAREN@[257; 258) | ||
258 | R_PAREN@[258; 259) | ||
259 | err: `expected COMMA` | ||
260 | WHITESPACE@[259; 260) | ||
261 | err: `expected pattern` | ||
262 | PARAM@[260; 261) | ||
263 | ERROR@[260; 261) | ||
264 | L_CURLY@[260; 261) | ||
265 | err: `expected COMMA` | ||
266 | WHITESPACE@[261; 278) | ||
267 | PARAM@[278; 283) | ||
268 | BIND_PAT@[278; 283) | ||
269 | NAME@[278; 283) | ||
270 | IDENT@[278; 283) "break" | ||
271 | err: `expected COMMA` | ||
272 | err: `expected pattern` | ||
273 | PARAM@[283; 284) | ||
274 | ERROR@[283; 284) | ||
275 | SEMI@[283; 284) | ||
276 | err: `expected COMMA` | ||
277 | WHITESPACE@[284; 297) | ||
278 | err: `expected pattern` | ||
279 | PARAM@[297; 298) | ||
280 | ERROR@[297; 298) | ||
281 | R_CURLY@[297; 298) | ||
282 | err: `expected COMMA` | ||
283 | WHITESPACE@[298; 311) | ||
284 | PARAM@[311; 318) | ||
285 | BIND_PAT@[311; 318) | ||
286 | NAME@[311; 318) | ||
287 | IDENT@[311; 318) "builder" | ||
288 | err: `expected COMMA` | ||
289 | err: `expected pattern` | ||
290 | PARAM@[318; 319) | ||
291 | ERROR@[318; 319) | ||
292 | DOT@[318; 319) | ||
293 | err: `expected COMMA` | ||
294 | PARAM@[319; 346) | ||
295 | TUPLE_STRUCT_PAT@[319; 346) | ||
296 | PATH@[319; 323) | ||
297 | PATH_SEGMENT@[319; 323) | ||
298 | NAME_REF@[319; 323) | ||
299 | IDENT@[319; 323) "leaf" | ||
300 | L_PAREN@[323; 324) | ||
301 | BIND_PAT@[324; 329) | ||
302 | NAME@[324; 329) | ||
303 | IDENT@[324; 329) "token" | ||
304 | err: `expected COMMA` | ||
305 | err: `expected pattern` | ||
306 | ERROR@[329; 330) | ||
307 | DOT@[329; 330) | ||
308 | err: `expected COMMA` | ||
309 | BIND_PAT@[330; 334) | ||
310 | NAME@[330; 334) | ||
311 | IDENT@[330; 334) "kind" | ||
312 | COMMA@[334; 335) | ||
313 | WHITESPACE@[335; 336) | ||
314 | BIND_PAT@[336; 341) | ||
315 | NAME@[336; 341) | ||
316 | IDENT@[336; 341) "token" | ||
317 | err: `expected COMMA` | ||
318 | err: `expected pattern` | ||
319 | ERROR@[341; 342) | ||
320 | DOT@[341; 342) | ||
321 | err: `expected COMMA` | ||
322 | BIND_PAT@[342; 345) | ||
323 | NAME@[342; 345) | ||
324 | IDENT@[342; 345) "len" | ||
325 | R_PAREN@[345; 346) | ||
326 | err: `expected COMMA` | ||
327 | err: `expected pattern` | ||
328 | PARAM@[346; 347) | ||
329 | ERROR@[346; 347) | ||
330 | SEMI@[346; 347) | ||
331 | err: `expected COMMA` | ||
332 | WHITESPACE@[347; 360) | ||
333 | err: `expected pattern` | ||
334 | PARAM@[360; 361) | ||
335 | ERROR@[360; 361) | ||
336 | STAR@[360; 361) | ||
337 | err: `expected COMMA` | ||
338 | PARAM@[361; 364) | ||
339 | BIND_PAT@[361; 364) | ||
340 | NAME@[361; 364) | ||
341 | IDENT@[361; 364) "idx" | ||
342 | err: `expected COMMA` | ||
343 | WHITESPACE@[364; 365) | ||
344 | err: `expected pattern` | ||
345 | PARAM@[365; 366) | ||
346 | ERROR@[365; 366) | ||
347 | PLUS@[365; 366) | ||
348 | err: `expected COMMA` | ||
349 | err: `expected pattern` | ||
350 | PARAM@[366; 367) | ||
351 | ERROR@[366; 367) | ||
352 | EQ@[366; 367) | ||
353 | err: `expected COMMA` | ||
354 | WHITESPACE@[367; 368) | ||
355 | PARAM@[368; 369) | ||
356 | LITERAL@[368; 369) | ||
357 | INT_NUMBER@[368; 369) "1" | ||
358 | err: `expected COMMA` | ||
359 | WHITESPACE@[369; 378) | ||
360 | err: `expected pattern` | ||
361 | PARAM@[378; 379) | ||
362 | ERROR@[378; 379) | ||
363 | R_CURLY@[378; 379) | ||
364 | err: `expected COMMA` | ||
365 | WHITESPACE@[379; 384) | ||
366 | err: `expected pattern` | ||
367 | PARAM@[384; 385) | ||
368 | ERROR@[384; 385) | ||
369 | R_CURLY@[384; 385) | ||
370 | err: `expected COMMA` | ||
371 | err: `expected pattern` | ||
372 | PARAM@[385; 386) | ||
373 | ERROR@[385; 386) | ||
374 | SEMI@[385; 386) | ||
375 | err: `expected COMMA` | ||
376 | WHITESPACE@[386; 387) | ||
377 | err: `expected pattern` | ||
378 | PARAM@[387; 388) | ||
379 | ERROR@[387; 388) | ||
380 | R_CURLY@[387; 388) | ||
381 | err: `expected COMMA` | ||
382 | err: `expected PIPE` | ||
383 | WHITESPACE@[388; 389) | ||
384 | err: `expected expression` | ||
385 | err: `expected SEMI` | ||
386 | err: `expected R_CURLY` | ||
387 | ERROR@[389; 389) | ||