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/ok/0062_macro_2.0.txt | |
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/ok/0062_macro_2.0.txt')
-rw-r--r-- | crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.txt | 174 |
1 files changed, 174 insertions, 0 deletions
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" | ||