diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-21 10:47:47 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-21 10:47:47 +0000 |
commit | 90ef070db3dce0a7acb9cd11d0b0d72de13c9d79 (patch) | |
tree | c6fcc8c77fe4948b356e397fb5fe1f8e8ac39037 /crates/ra_syntax/test_data/parser | |
parent | 3ebf15c9b29b1fed6319d04f540ad48cd4bd6995 (diff) | |
parent | 4195c0e5f9a3db7646d4df28aa8c77a863c35759 (diff) |
Merge #2628
2628: Add macro 2.0 support in parser r=matklad a=edwin0cheng
This PR added a new syntax kind : `MACRO_DEF` and a keyword `MACRO_KW`
there are two syntax for declarative macro 2.0 :
1. Normal : `macro m { ($i:ident) => {} }` , which handle similar to legacy one.
2. Call like: `macro m($i:ident) {}`, it produces a single token tree which have two child token trees : `($i:ident)` and `{}`
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/ra_syntax/test_data/parser')
-rw-r--r-- | crates/ra_syntax/test_data/parser/err/0028_macro_2.0.txt | 328 | ||||
-rw-r--r-- | crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.txt | 43 | ||||
-rw-r--r-- | crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.rs | 1 | ||||
-rw-r--r-- | crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.txt | 20 | ||||
-rw-r--r-- | crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rs (renamed from crates/ra_syntax/test_data/parser/err/0028_macro_2.0.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.txt | 174 |
7 files changed, 240 insertions, 328 deletions
diff --git a/crates/ra_syntax/test_data/parser/err/0028_macro_2.0.txt b/crates/ra_syntax/test_data/parser/err/0028_macro_2.0.txt deleted file mode 100644 index c5be73a5a..000000000 --- a/crates/ra_syntax/test_data/parser/err/0028_macro_2.0.txt +++ /dev/null | |||
@@ -1,328 +0,0 @@ | |||
1 | SOURCE_FILE@[0; 349) | ||
2 | MACRO_CALL@[0; 41) | ||
3 | PATH@[0; 5) | ||
4 | PATH_SEGMENT@[0; 5) | ||
5 | NAME_REF@[0; 5) | ||
6 | IDENT@[0; 5) "macro" | ||
7 | WHITESPACE@[5; 6) " " | ||
8 | NAME@[6; 21) | ||
9 | IDENT@[6; 21) "parse_use_trees" | ||
10 | TOKEN_TREE@[21; 41) | ||
11 | L_PAREN@[21; 22) "(" | ||
12 | DOLLAR@[22; 23) "$" | ||
13 | TOKEN_TREE@[23; 32) | ||
14 | L_PAREN@[23; 24) "(" | ||
15 | DOLLAR@[24; 25) "$" | ||
16 | IDENT@[25; 26) "s" | ||
17 | COLON@[26; 27) ":" | ||
18 | IDENT@[27; 31) "expr" | ||
19 | R_PAREN@[31; 32) ")" | ||
20 | COMMA@[32; 33) "," | ||
21 | STAR@[33; 34) "*" | ||
22 | WHITESPACE@[34; 35) " " | ||
23 | DOLLAR@[35; 36) "$" | ||
24 | TOKEN_TREE@[36; 39) | ||
25 | L_PAREN@[36; 37) "(" | ||
26 | COMMA@[37; 38) "," | ||
27 | R_PAREN@[38; 39) ")" | ||
28 | STAR@[39; 40) "*" | ||
29 | R_PAREN@[40; 41) ")" | ||
30 | WHITESPACE@[41; 42) " " | ||
31 | ERROR@[42; 93) | ||
32 | L_CURLY@[42; 43) "{" | ||
33 | WHITESPACE@[43; 48) "\n " | ||
34 | MACRO_CALL@[48; 91) | ||
35 | PATH@[48; 51) | ||
36 | PATH_SEGMENT@[48; 51) | ||
37 | NAME_REF@[48; 51) | ||
38 | IDENT@[48; 51) "vec" | ||
39 | EXCL@[51; 52) "!" | ||
40 | TOKEN_TREE@[52; 91) | ||
41 | L_BRACK@[52; 53) "[" | ||
42 | WHITESPACE@[53; 62) "\n " | ||
43 | DOLLAR@[62; 63) "$" | ||
44 | TOKEN_TREE@[63; 84) | ||
45 | L_PAREN@[63; 64) "(" | ||
46 | IDENT@[64; 78) "parse_use_tree" | ||
47 | TOKEN_TREE@[78; 82) | ||
48 | L_PAREN@[78; 79) "(" | ||
49 | DOLLAR@[79; 80) "$" | ||
50 | IDENT@[80; 81) "s" | ||
51 | R_PAREN@[81; 82) ")" | ||
52 | COMMA@[82; 83) "," | ||
53 | R_PAREN@[83; 84) ")" | ||
54 | STAR@[84; 85) "*" | ||
55 | WHITESPACE@[85; 90) "\n " | ||
56 | R_BRACK@[90; 91) "]" | ||
57 | WHITESPACE@[91; 92) "\n" | ||
58 | R_CURLY@[92; 93) "}" | ||
59 | WHITESPACE@[93; 95) "\n\n" | ||
60 | FN_DEF@[95; 348) | ||
61 | ATTR@[95; 102) | ||
62 | POUND@[95; 96) "#" | ||
63 | L_BRACK@[96; 97) "[" | ||
64 | PATH@[97; 101) | ||
65 | PATH_SEGMENT@[97; 101) | ||
66 | NAME_REF@[97; 101) | ||
67 | IDENT@[97; 101) "test" | ||
68 | R_BRACK@[101; 102) "]" | ||
69 | WHITESPACE@[102; 103) "\n" | ||
70 | FN_KW@[103; 105) "fn" | ||
71 | WHITESPACE@[105; 106) " " | ||
72 | NAME@[106; 125) | ||
73 | IDENT@[106; 125) "test_use_tree_merge" | ||
74 | PARAM_LIST@[125; 127) | ||
75 | L_PAREN@[125; 126) "(" | ||
76 | R_PAREN@[126; 127) ")" | ||
77 | WHITESPACE@[127; 128) " " | ||
78 | BLOCK_EXPR@[128; 348) | ||
79 | BLOCK@[128; 348) | ||
80 | L_CURLY@[128; 129) "{" | ||
81 | WHITESPACE@[129; 134) "\n " | ||
82 | EXPR_STMT@[134; 139) | ||
83 | PATH_EXPR@[134; 139) | ||
84 | PATH@[134; 139) | ||
85 | PATH_SEGMENT@[134; 139) | ||
86 | NAME_REF@[134; 139) | ||
87 | IDENT@[134; 139) "macro" | ||
88 | WHITESPACE@[139; 140) " " | ||
89 | EXPR_STMT@[140; 154) | ||
90 | CALL_EXPR@[140; 154) | ||
91 | PATH_EXPR@[140; 150) | ||
92 | PATH@[140; 150) | ||
93 | PATH_SEGMENT@[140; 150) | ||
94 | NAME_REF@[140; 150) | ||
95 | IDENT@[140; 150) "test_merge" | ||
96 | ARG_LIST@[150; 154) | ||
97 | L_PAREN@[150; 151) "(" | ||
98 | ARRAY_EXPR@[151; 154) | ||
99 | L_BRACK@[151; 152) "[" | ||
100 | ERROR@[152; 153) | ||
101 | DOLLAR@[152; 153) "$" | ||
102 | PAREN_EXPR@[153; 154) | ||
103 | L_PAREN@[153; 154) "(" | ||
104 | EXPR_STMT@[154; 155) | ||
105 | ERROR@[154; 155) | ||
106 | DOLLAR@[154; 155) "$" | ||
107 | EXPR_STMT@[155; 160) | ||
108 | PATH_EXPR@[155; 160) | ||
109 | PATH@[155; 160) | ||
110 | PATH_SEGMENT@[155; 160) | ||
111 | NAME_REF@[155; 160) | ||
112 | IDENT@[155; 160) "input" | ||
113 | EXPR_STMT@[160; 161) | ||
114 | ERROR@[160; 161) | ||
115 | COLON@[160; 161) ":" | ||
116 | EXPR_STMT@[161; 165) | ||
117 | PATH_EXPR@[161; 165) | ||
118 | PATH@[161; 165) | ||
119 | PATH_SEGMENT@[161; 165) | ||
120 | NAME_REF@[161; 165) | ||
121 | IDENT@[161; 165) "expr" | ||
122 | EXPR_STMT@[165; 166) | ||
123 | ERROR@[165; 166) | ||
124 | R_PAREN@[165; 166) ")" | ||
125 | EXPR_STMT@[166; 167) | ||
126 | ERROR@[166; 167) | ||
127 | COMMA@[166; 167) "," | ||
128 | EXPR_STMT@[167; 170) | ||
129 | PREFIX_EXPR@[167; 170) | ||
130 | STAR@[167; 168) "*" | ||
131 | WHITESPACE@[168; 169) " " | ||
132 | ERROR@[169; 170) | ||
133 | DOLLAR@[169; 170) "$" | ||
134 | EXPR_STMT@[170; 171) | ||
135 | PAREN_EXPR@[170; 171) | ||
136 | L_PAREN@[170; 171) "(" | ||
137 | EXPR_STMT@[171; 172) | ||
138 | ERROR@[171; 172) | ||
139 | COMMA@[171; 172) "," | ||
140 | EXPR_STMT@[172; 173) | ||
141 | ERROR@[172; 173) | ||
142 | R_PAREN@[172; 173) ")" | ||
143 | EXPR_STMT@[173; 175) | ||
144 | PREFIX_EXPR@[173; 175) | ||
145 | STAR@[173; 174) "*" | ||
146 | ERROR@[174; 175) | ||
147 | R_BRACK@[174; 175) "]" | ||
148 | EXPR_STMT@[175; 176) | ||
149 | ERROR@[175; 176) | ||
150 | COMMA@[175; 176) "," | ||
151 | WHITESPACE@[176; 177) " " | ||
152 | EXPR_STMT@[177; 180) | ||
153 | ARRAY_EXPR@[177; 180) | ||
154 | L_BRACK@[177; 178) "[" | ||
155 | ERROR@[178; 179) | ||
156 | DOLLAR@[178; 179) "$" | ||
157 | PAREN_EXPR@[179; 180) | ||
158 | L_PAREN@[179; 180) "(" | ||
159 | EXPR_STMT@[180; 181) | ||
160 | ERROR@[180; 181) | ||
161 | DOLLAR@[180; 181) "$" | ||
162 | EXPR_STMT@[181; 187) | ||
163 | PATH_EXPR@[181; 187) | ||
164 | PATH@[181; 187) | ||
165 | PATH_SEGMENT@[181; 187) | ||
166 | NAME_REF@[181; 187) | ||
167 | IDENT@[181; 187) "output" | ||
168 | EXPR_STMT@[187; 188) | ||
169 | ERROR@[187; 188) | ||
170 | COLON@[187; 188) ":" | ||
171 | EXPR_STMT@[188; 192) | ||
172 | PATH_EXPR@[188; 192) | ||
173 | PATH@[188; 192) | ||
174 | PATH_SEGMENT@[188; 192) | ||
175 | NAME_REF@[188; 192) | ||
176 | IDENT@[188; 192) "expr" | ||
177 | EXPR_STMT@[192; 193) | ||
178 | ERROR@[192; 193) | ||
179 | R_PAREN@[192; 193) ")" | ||
180 | EXPR_STMT@[193; 194) | ||
181 | ERROR@[193; 194) | ||
182 | COMMA@[193; 194) "," | ||
183 | EXPR_STMT@[194; 197) | ||
184 | PREFIX_EXPR@[194; 197) | ||
185 | STAR@[194; 195) "*" | ||
186 | WHITESPACE@[195; 196) " " | ||
187 | ERROR@[196; 197) | ||
188 | DOLLAR@[196; 197) "$" | ||
189 | EXPR_STMT@[197; 198) | ||
190 | PAREN_EXPR@[197; 198) | ||
191 | L_PAREN@[197; 198) "(" | ||
192 | EXPR_STMT@[198; 199) | ||
193 | ERROR@[198; 199) | ||
194 | COMMA@[198; 199) "," | ||
195 | EXPR_STMT@[199; 200) | ||
196 | ERROR@[199; 200) | ||
197 | R_PAREN@[199; 200) ")" | ||
198 | EXPR_STMT@[200; 202) | ||
199 | PREFIX_EXPR@[200; 202) | ||
200 | STAR@[200; 201) "*" | ||
201 | ERROR@[201; 202) | ||
202 | R_BRACK@[201; 202) "]" | ||
203 | EXPR_STMT@[202; 203) | ||
204 | ERROR@[202; 203) | ||
205 | R_PAREN@[202; 203) ")" | ||
206 | WHITESPACE@[203; 204) " " | ||
207 | BLOCK_EXPR@[204; 346) | ||
208 | BLOCK@[204; 346) | ||
209 | L_CURLY@[204; 205) "{" | ||
210 | WHITESPACE@[205; 214) "\n " | ||
211 | EXPR_STMT@[214; 340) | ||
212 | MACRO_CALL@[214; 339) | ||
213 | PATH@[214; 223) | ||
214 | PATH_SEGMENT@[214; 223) | ||
215 | NAME_REF@[214; 223) | ||
216 | IDENT@[214; 223) "assert_eq" | ||
217 | EXCL@[223; 224) "!" | ||
218 | TOKEN_TREE@[224; 339) | ||
219 | L_PAREN@[224; 225) "(" | ||
220 | WHITESPACE@[225; 238) "\n " | ||
221 | IDENT@[238; 253) "merge_use_trees" | ||
222 | TOKEN_TREE@[253; 284) | ||
223 | L_PAREN@[253; 254) "(" | ||
224 | IDENT@[254; 269) "parse_use_trees" | ||
225 | EXCL@[269; 270) "!" | ||
226 | TOKEN_TREE@[270; 283) | ||
227 | L_PAREN@[270; 271) "(" | ||
228 | DOLLAR@[271; 272) "$" | ||
229 | TOKEN_TREE@[272; 281) | ||
230 | L_PAREN@[272; 273) "(" | ||
231 | DOLLAR@[273; 274) "$" | ||
232 | IDENT@[274; 279) "input" | ||
233 | COMMA@[279; 280) "," | ||
234 | R_PAREN@[280; 281) ")" | ||
235 | STAR@[281; 282) "*" | ||
236 | R_PAREN@[282; 283) ")" | ||
237 | R_PAREN@[283; 284) ")" | ||
238 | COMMA@[284; 285) "," | ||
239 | WHITESPACE@[285; 298) "\n " | ||
240 | IDENT@[298; 313) "parse_use_trees" | ||
241 | EXCL@[313; 314) "!" | ||
242 | TOKEN_TREE@[314; 328) | ||
243 | L_PAREN@[314; 315) "(" | ||
244 | DOLLAR@[315; 316) "$" | ||
245 | TOKEN_TREE@[316; 326) | ||
246 | L_PAREN@[316; 317) "(" | ||
247 | DOLLAR@[317; 318) "$" | ||
248 | IDENT@[318; 324) "output" | ||
249 | COMMA@[324; 325) "," | ||
250 | R_PAREN@[325; 326) ")" | ||
251 | STAR@[326; 327) "*" | ||
252 | R_PAREN@[327; 328) ")" | ||
253 | COMMA@[328; 329) "," | ||
254 | WHITESPACE@[329; 338) "\n " | ||
255 | R_PAREN@[338; 339) ")" | ||
256 | SEMI@[339; 340) ";" | ||
257 | WHITESPACE@[340; 345) "\n " | ||
258 | R_CURLY@[345; 346) "}" | ||
259 | WHITESPACE@[346; 347) "\n" | ||
260 | R_CURLY@[347; 348) "}" | ||
261 | WHITESPACE@[348; 349) "\n" | ||
262 | error 5: expected EXCL | ||
263 | error 41: expected SEMI | ||
264 | error 42: expected an item | ||
265 | error 139: expected SEMI | ||
266 | error 152: expected expression | ||
267 | error 153: expected COMMA | ||
268 | error 154: expected expression | ||
269 | error 154: expected R_PAREN | ||
270 | error 154: expected COMMA | ||
271 | error 154: expected expression | ||
272 | error 154: expected R_BRACK | ||
273 | error 154: expected COMMA | ||
274 | error 154: expected SEMI | ||
275 | error 154: expected expression | ||
276 | error 155: expected SEMI | ||
277 | error 160: expected SEMI | ||
278 | error 160: expected expression | ||
279 | error 161: expected SEMI | ||
280 | error 165: expected SEMI | ||
281 | error 165: expected expression | ||
282 | error 166: expected SEMI | ||
283 | error 166: expected expression | ||
284 | error 167: expected SEMI | ||
285 | error 169: expected expression | ||
286 | error 170: expected SEMI | ||
287 | error 171: expected expression | ||
288 | error 171: expected R_PAREN | ||
289 | error 171: expected SEMI | ||
290 | error 171: expected expression | ||
291 | error 172: expected SEMI | ||
292 | error 172: expected expression | ||
293 | error 173: expected SEMI | ||
294 | error 174: expected expression | ||
295 | error 175: expected SEMI | ||
296 | error 175: expected expression | ||
297 | error 176: expected SEMI | ||
298 | error 178: expected expression | ||
299 | error 179: expected COMMA | ||
300 | error 180: expected expression | ||
301 | error 180: expected R_PAREN | ||
302 | error 180: expected COMMA | ||
303 | error 180: expected expression | ||
304 | error 180: expected R_BRACK | ||
305 | error 180: expected SEMI | ||
306 | error 180: expected expression | ||
307 | error 181: expected SEMI | ||
308 | error 187: expected SEMI | ||
309 | error 187: expected expression | ||
310 | error 188: expected SEMI | ||
311 | error 192: expected SEMI | ||
312 | error 192: expected expression | ||
313 | error 193: expected SEMI | ||
314 | error 193: expected expression | ||
315 | error 194: expected SEMI | ||
316 | error 196: expected expression | ||
317 | error 197: expected SEMI | ||
318 | error 198: expected expression | ||
319 | error 198: expected R_PAREN | ||
320 | error 198: expected SEMI | ||
321 | error 198: expected expression | ||
322 | error 199: expected SEMI | ||
323 | error 199: expected expression | ||
324 | error 200: expected SEMI | ||
325 | error 201: expected expression | ||
326 | error 202: expected SEMI | ||
327 | error 202: expected expression | ||
328 | error 203: expected SEMI | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.rs b/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.rs new file mode 100644 index 000000000..319a4e2aa --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.rs | |||
@@ -0,0 +1,2 @@ | |||
1 | macro m { ($i:ident) => {} } | ||
2 | macro m($i:ident) {} | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.txt b/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.txt new file mode 100644 index 000000000..af1122bfa --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.txt | |||
@@ -0,0 +1,43 @@ | |||
1 | SOURCE_FILE@[0; 50) | ||
2 | MACRO_DEF@[0; 28) | ||
3 | MACRO_KW@[0; 5) "macro" | ||
4 | WHITESPACE@[5; 6) " " | ||
5 | IDENT@[6; 7) "m" | ||
6 | WHITESPACE@[7; 8) " " | ||
7 | TOKEN_TREE@[8; 28) | ||
8 | L_CURLY@[8; 9) "{" | ||
9 | WHITESPACE@[9; 10) " " | ||
10 | TOKEN_TREE@[10; 20) | ||
11 | L_PAREN@[10; 11) "(" | ||
12 | DOLLAR@[11; 12) "$" | ||
13 | IDENT@[12; 13) "i" | ||
14 | COLON@[13; 14) ":" | ||
15 | IDENT@[14; 19) "ident" | ||
16 | R_PAREN@[19; 20) ")" | ||
17 | WHITESPACE@[20; 21) " " | ||
18 | EQ@[21; 22) "=" | ||
19 | R_ANGLE@[22; 23) ">" | ||
20 | WHITESPACE@[23; 24) " " | ||
21 | TOKEN_TREE@[24; 26) | ||
22 | L_CURLY@[24; 25) "{" | ||
23 | R_CURLY@[25; 26) "}" | ||
24 | WHITESPACE@[26; 27) " " | ||
25 | R_CURLY@[27; 28) "}" | ||
26 | WHITESPACE@[28; 29) "\n" | ||
27 | MACRO_DEF@[29; 49) | ||
28 | MACRO_KW@[29; 34) "macro" | ||
29 | WHITESPACE@[34; 35) " " | ||
30 | IDENT@[35; 36) "m" | ||
31 | TOKEN_TREE@[36; 49) | ||
32 | TOKEN_TREE@[36; 46) | ||
33 | L_PAREN@[36; 37) "(" | ||
34 | DOLLAR@[37; 38) "$" | ||
35 | IDENT@[38; 39) "i" | ||
36 | COLON@[39; 40) ":" | ||
37 | IDENT@[40; 45) "ident" | ||
38 | R_PAREN@[45; 46) ")" | ||
39 | WHITESPACE@[46; 47) " " | ||
40 | TOKEN_TREE@[47; 49) | ||
41 | L_CURLY@[47; 48) "{" | ||
42 | R_CURLY@[48; 49) "}" | ||
43 | WHITESPACE@[49; 50) "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.rs b/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.rs new file mode 100644 index 000000000..3b2be597f --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.rs | |||
@@ -0,0 +1 @@ | |||
pub macro m($:ident) {} | |||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.txt b/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.txt new file mode 100644 index 000000000..985f61f89 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.txt | |||
@@ -0,0 +1,20 @@ | |||
1 | SOURCE_FILE@[0; 24) | ||
2 | MACRO_DEF@[0; 23) | ||
3 | VISIBILITY@[0; 3) | ||
4 | PUB_KW@[0; 3) "pub" | ||
5 | WHITESPACE@[3; 4) " " | ||
6 | MACRO_KW@[4; 9) "macro" | ||
7 | WHITESPACE@[9; 10) " " | ||
8 | IDENT@[10; 11) "m" | ||
9 | TOKEN_TREE@[11; 23) | ||
10 | TOKEN_TREE@[11; 20) | ||
11 | L_PAREN@[11; 12) "(" | ||
12 | DOLLAR@[12; 13) "$" | ||
13 | COLON@[13; 14) ":" | ||
14 | IDENT@[14; 19) "ident" | ||
15 | R_PAREN@[19; 20) ")" | ||
16 | WHITESPACE@[20; 21) " " | ||
17 | TOKEN_TREE@[21; 23) | ||
18 | L_CURLY@[21; 22) "{" | ||
19 | R_CURLY@[22; 23) "}" | ||
20 | WHITESPACE@[23; 24) "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0028_macro_2.0.rs b/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rs index 781047ba1..781047ba1 100644 --- a/crates/ra_syntax/test_data/parser/err/0028_macro_2.0.rs +++ b/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rs | |||
diff --git a/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.txt b/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.txt new file mode 100644 index 000000000..158af85f5 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.txt | |||
@@ -0,0 +1,174 @@ | |||
1 | SOURCE_FILE@[0; 349) | ||
2 | MACRO_DEF@[0; 93) | ||
3 | MACRO_KW@[0; 5) "macro" | ||
4 | WHITESPACE@[5; 6) " " | ||
5 | IDENT@[6; 21) "parse_use_trees" | ||
6 | TOKEN_TREE@[21; 93) | ||
7 | TOKEN_TREE@[21; 41) | ||
8 | L_PAREN@[21; 22) "(" | ||
9 | DOLLAR@[22; 23) "$" | ||
10 | TOKEN_TREE@[23; 32) | ||
11 | L_PAREN@[23; 24) "(" | ||
12 | DOLLAR@[24; 25) "$" | ||
13 | IDENT@[25; 26) "s" | ||
14 | COLON@[26; 27) ":" | ||
15 | IDENT@[27; 31) "expr" | ||
16 | R_PAREN@[31; 32) ")" | ||
17 | COMMA@[32; 33) "," | ||
18 | STAR@[33; 34) "*" | ||
19 | WHITESPACE@[34; 35) " " | ||
20 | DOLLAR@[35; 36) "$" | ||
21 | TOKEN_TREE@[36; 39) | ||
22 | L_PAREN@[36; 37) "(" | ||
23 | COMMA@[37; 38) "," | ||
24 | R_PAREN@[38; 39) ")" | ||
25 | STAR@[39; 40) "*" | ||
26 | R_PAREN@[40; 41) ")" | ||
27 | WHITESPACE@[41; 42) " " | ||
28 | TOKEN_TREE@[42; 93) | ||
29 | L_CURLY@[42; 43) "{" | ||
30 | WHITESPACE@[43; 48) "\n " | ||
31 | IDENT@[48; 51) "vec" | ||
32 | EXCL@[51; 52) "!" | ||
33 | TOKEN_TREE@[52; 91) | ||
34 | L_BRACK@[52; 53) "[" | ||
35 | WHITESPACE@[53; 62) "\n " | ||
36 | DOLLAR@[62; 63) "$" | ||
37 | TOKEN_TREE@[63; 84) | ||
38 | L_PAREN@[63; 64) "(" | ||
39 | IDENT@[64; 78) "parse_use_tree" | ||
40 | TOKEN_TREE@[78; 82) | ||
41 | L_PAREN@[78; 79) "(" | ||
42 | DOLLAR@[79; 80) "$" | ||
43 | IDENT@[80; 81) "s" | ||
44 | R_PAREN@[81; 82) ")" | ||
45 | COMMA@[82; 83) "," | ||
46 | R_PAREN@[83; 84) ")" | ||
47 | STAR@[84; 85) "*" | ||
48 | WHITESPACE@[85; 90) "\n " | ||
49 | R_BRACK@[90; 91) "]" | ||
50 | WHITESPACE@[91; 92) "\n" | ||
51 | R_CURLY@[92; 93) "}" | ||
52 | WHITESPACE@[93; 95) "\n\n" | ||
53 | FN_DEF@[95; 348) | ||
54 | ATTR@[95; 102) | ||
55 | POUND@[95; 96) "#" | ||
56 | L_BRACK@[96; 97) "[" | ||
57 | PATH@[97; 101) | ||
58 | PATH_SEGMENT@[97; 101) | ||
59 | NAME_REF@[97; 101) | ||
60 | IDENT@[97; 101) "test" | ||
61 | R_BRACK@[101; 102) "]" | ||
62 | WHITESPACE@[102; 103) "\n" | ||
63 | FN_KW@[103; 105) "fn" | ||
64 | WHITESPACE@[105; 106) " " | ||
65 | NAME@[106; 125) | ||
66 | IDENT@[106; 125) "test_use_tree_merge" | ||
67 | PARAM_LIST@[125; 127) | ||
68 | L_PAREN@[125; 126) "(" | ||
69 | R_PAREN@[126; 127) ")" | ||
70 | WHITESPACE@[127; 128) " " | ||
71 | BLOCK_EXPR@[128; 348) | ||
72 | BLOCK@[128; 348) | ||
73 | L_CURLY@[128; 129) "{" | ||
74 | WHITESPACE@[129; 134) "\n " | ||
75 | MACRO_DEF@[134; 346) | ||
76 | MACRO_KW@[134; 139) "macro" | ||
77 | WHITESPACE@[139; 140) " " | ||
78 | IDENT@[140; 150) "test_merge" | ||
79 | TOKEN_TREE@[150; 346) | ||
80 | TOKEN_TREE@[150; 203) | ||
81 | L_PAREN@[150; 151) "(" | ||
82 | TOKEN_TREE@[151; 175) | ||
83 | L_BRACK@[151; 152) "[" | ||
84 | DOLLAR@[152; 153) "$" | ||
85 | TOKEN_TREE@[153; 166) | ||
86 | L_PAREN@[153; 154) "(" | ||
87 | DOLLAR@[154; 155) "$" | ||
88 | IDENT@[155; 160) "input" | ||
89 | COLON@[160; 161) ":" | ||
90 | IDENT@[161; 165) "expr" | ||
91 | R_PAREN@[165; 166) ")" | ||
92 | COMMA@[166; 167) "," | ||
93 | STAR@[167; 168) "*" | ||
94 | WHITESPACE@[168; 169) " " | ||
95 | DOLLAR@[169; 170) "$" | ||
96 | TOKEN_TREE@[170; 173) | ||
97 | L_PAREN@[170; 171) "(" | ||
98 | COMMA@[171; 172) "," | ||
99 | R_PAREN@[172; 173) ")" | ||
100 | STAR@[173; 174) "*" | ||
101 | R_BRACK@[174; 175) "]" | ||
102 | COMMA@[175; 176) "," | ||
103 | WHITESPACE@[176; 177) " " | ||
104 | TOKEN_TREE@[177; 202) | ||
105 | L_BRACK@[177; 178) "[" | ||
106 | DOLLAR@[178; 179) "$" | ||
107 | TOKEN_TREE@[179; 193) | ||
108 | L_PAREN@[179; 180) "(" | ||
109 | DOLLAR@[180; 181) "$" | ||
110 | IDENT@[181; 187) "output" | ||
111 | COLON@[187; 188) ":" | ||
112 | IDENT@[188; 192) "expr" | ||
113 | R_PAREN@[192; 193) ")" | ||
114 | COMMA@[193; 194) "," | ||
115 | STAR@[194; 195) "*" | ||
116 | WHITESPACE@[195; 196) " " | ||
117 | DOLLAR@[196; 197) "$" | ||
118 | TOKEN_TREE@[197; 200) | ||
119 | L_PAREN@[197; 198) "(" | ||
120 | COMMA@[198; 199) "," | ||
121 | R_PAREN@[199; 200) ")" | ||
122 | STAR@[200; 201) "*" | ||
123 | R_BRACK@[201; 202) "]" | ||
124 | R_PAREN@[202; 203) ")" | ||
125 | WHITESPACE@[203; 204) " " | ||
126 | TOKEN_TREE@[204; 346) | ||
127 | L_CURLY@[204; 205) "{" | ||
128 | WHITESPACE@[205; 214) "\n " | ||
129 | IDENT@[214; 223) "assert_eq" | ||
130 | EXCL@[223; 224) "!" | ||
131 | TOKEN_TREE@[224; 339) | ||
132 | L_PAREN@[224; 225) "(" | ||
133 | WHITESPACE@[225; 238) "\n " | ||
134 | IDENT@[238; 253) "merge_use_trees" | ||
135 | TOKEN_TREE@[253; 284) | ||
136 | L_PAREN@[253; 254) "(" | ||
137 | IDENT@[254; 269) "parse_use_trees" | ||
138 | EXCL@[269; 270) "!" | ||
139 | TOKEN_TREE@[270; 283) | ||
140 | L_PAREN@[270; 271) "(" | ||
141 | DOLLAR@[271; 272) "$" | ||
142 | TOKEN_TREE@[272; 281) | ||
143 | L_PAREN@[272; 273) "(" | ||
144 | DOLLAR@[273; 274) "$" | ||
145 | IDENT@[274; 279) "input" | ||
146 | COMMA@[279; 280) "," | ||
147 | R_PAREN@[280; 281) ")" | ||
148 | STAR@[281; 282) "*" | ||
149 | R_PAREN@[282; 283) ")" | ||
150 | R_PAREN@[283; 284) ")" | ||
151 | COMMA@[284; 285) "," | ||
152 | WHITESPACE@[285; 298) "\n " | ||
153 | IDENT@[298; 313) "parse_use_trees" | ||
154 | EXCL@[313; 314) "!" | ||
155 | TOKEN_TREE@[314; 328) | ||
156 | L_PAREN@[314; 315) "(" | ||
157 | DOLLAR@[315; 316) "$" | ||
158 | TOKEN_TREE@[316; 326) | ||
159 | L_PAREN@[316; 317) "(" | ||
160 | DOLLAR@[317; 318) "$" | ||
161 | IDENT@[318; 324) "output" | ||
162 | COMMA@[324; 325) "," | ||
163 | R_PAREN@[325; 326) ")" | ||
164 | STAR@[326; 327) "*" | ||
165 | R_PAREN@[327; 328) ")" | ||
166 | COMMA@[328; 329) "," | ||
167 | WHITESPACE@[329; 338) "\n " | ||
168 | R_PAREN@[338; 339) ")" | ||
169 | SEMI@[339; 340) ";" | ||
170 | WHITESPACE@[340; 345) "\n " | ||
171 | R_CURLY@[345; 346) "}" | ||
172 | WHITESPACE@[346; 347) "\n" | ||
173 | R_CURLY@[347; 348) "}" | ||
174 | WHITESPACE@[348; 349) "\n" | ||