diff options
Diffstat (limited to 'src/syntax_kinds/generated.rs')
-rw-r--r-- | src/syntax_kinds/generated.rs | 326 |
1 files changed, 326 insertions, 0 deletions
diff --git a/src/syntax_kinds/generated.rs b/src/syntax_kinds/generated.rs new file mode 100644 index 000000000..d332fd02e --- /dev/null +++ b/src/syntax_kinds/generated.rs | |||
@@ -0,0 +1,326 @@ | |||
1 | #![allow(bad_style, missing_docs, unreachable_pub)] | ||
2 | #![cfg_attr(rustfmt, rustfmt_skip)] | ||
3 | //! Generated from grammar.ron | ||
4 | use super::SyntaxInfo; | ||
5 | |||
6 | /// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`. | ||
7 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] | ||
8 | pub enum SyntaxKind { | ||
9 | ERROR, | ||
10 | IDENT, | ||
11 | UNDERSCORE, | ||
12 | WHITESPACE, | ||
13 | INT_NUMBER, | ||
14 | FLOAT_NUMBER, | ||
15 | SEMI, | ||
16 | COMMA, | ||
17 | DOT, | ||
18 | DOTDOT, | ||
19 | DOTDOTDOT, | ||
20 | DOTDOTEQ, | ||
21 | L_PAREN, | ||
22 | R_PAREN, | ||
23 | L_CURLY, | ||
24 | R_CURLY, | ||
25 | L_BRACK, | ||
26 | R_BRACK, | ||
27 | L_ANGLE, | ||
28 | R_ANGLE, | ||
29 | AT, | ||
30 | POUND, | ||
31 | TILDE, | ||
32 | QUESTION, | ||
33 | COLON, | ||
34 | COLONCOLON, | ||
35 | DOLLAR, | ||
36 | EQ, | ||
37 | EQEQ, | ||
38 | FAT_ARROW, | ||
39 | NEQ, | ||
40 | EXCL, | ||
41 | LIFETIME, | ||
42 | CHAR, | ||
43 | BYTE, | ||
44 | STRING, | ||
45 | RAW_STRING, | ||
46 | BYTE_STRING, | ||
47 | RAW_BYTE_STRING, | ||
48 | PLUS, | ||
49 | MINUS, | ||
50 | STAR, | ||
51 | SLASH, | ||
52 | CARET, | ||
53 | PERCENT, | ||
54 | AMPERSAND, | ||
55 | PIPE, | ||
56 | THIN_ARROW, | ||
57 | COMMENT, | ||
58 | DOC_COMMENT, | ||
59 | SHEBANG, | ||
60 | USE_KW, | ||
61 | FN_KW, | ||
62 | STRUCT_KW, | ||
63 | ENUM_KW, | ||
64 | TRAIT_KW, | ||
65 | IMPL_KW, | ||
66 | TRUE_KW, | ||
67 | FALSE_KW, | ||
68 | AS_KW, | ||
69 | EXTERN_KW, | ||
70 | CRATE_KW, | ||
71 | MOD_KW, | ||
72 | PUB_KW, | ||
73 | SELF_KW, | ||
74 | SUPER_KW, | ||
75 | IN_KW, | ||
76 | WHERE_KW, | ||
77 | FOR_KW, | ||
78 | LOOP_KW, | ||
79 | WHILE_KW, | ||
80 | IF_KW, | ||
81 | MATCH_KW, | ||
82 | CONST_KW, | ||
83 | STATIC_KW, | ||
84 | MUT_KW, | ||
85 | UNSAFE_KW, | ||
86 | TYPE_KW, | ||
87 | REF_KW, | ||
88 | LET_KW, | ||
89 | AUTO_KW, | ||
90 | DEFAULT_KW, | ||
91 | UNION_KW, | ||
92 | FILE, | ||
93 | STRUCT_ITEM, | ||
94 | ENUM_ITEM, | ||
95 | FN_ITEM, | ||
96 | EXTERN_CRATE_ITEM, | ||
97 | MOD_ITEM, | ||
98 | USE_ITEM, | ||
99 | STATIC_ITEM, | ||
100 | CONST_ITEM, | ||
101 | TRAIT_ITEM, | ||
102 | IMPL_ITEM, | ||
103 | TYPE_ITEM, | ||
104 | PAREN_TYPE, | ||
105 | TUPLE_TYPE, | ||
106 | NEVER_TYPE, | ||
107 | PATH_TYPE, | ||
108 | POINTER_TYPE, | ||
109 | ARRAY_TYPE, | ||
110 | SLICE_TYPE, | ||
111 | REFERENCE_TYPE, | ||
112 | PLACEHOLDER_TYPE, | ||
113 | FN_POINTER_TYPE, | ||
114 | FOR_TYPE, | ||
115 | REF_PAT, | ||
116 | BIND_PAT, | ||
117 | PLACEHOLDER_PAT, | ||
118 | TUPLE_EXPR, | ||
119 | EXTERN_BLOCK, | ||
120 | ENUM_VARIANT, | ||
121 | NAMED_FIELD, | ||
122 | POS_FIELD, | ||
123 | ATTR, | ||
124 | META_ITEM, | ||
125 | USE_TREE, | ||
126 | PATH, | ||
127 | PATH_SEGMENT, | ||
128 | LITERAL, | ||
129 | ALIAS, | ||
130 | VISIBILITY, | ||
131 | TYPE_PARAM_LIST, | ||
132 | WHERE_CLAUSE, | ||
133 | LIFETIME_PARAM, | ||
134 | TYPE_PARAM, | ||
135 | ABI, | ||
136 | NAME, | ||
137 | NAME_REF, | ||
138 | VALUE_PARAMETER, | ||
139 | BLOCK, | ||
140 | LET_STMT, | ||
141 | |||
142 | // Technical SyntaxKinds: they appear temporally during parsing, | ||
143 | // but never end up in the final tree | ||
144 | #[doc(hidden)] | ||
145 | TOMBSTONE, | ||
146 | #[doc(hidden)] | ||
147 | EOF, | ||
148 | } | ||
149 | pub(crate) use self::SyntaxKind::*; | ||
150 | |||
151 | impl SyntaxKind { | ||
152 | pub(crate) fn info(self) -> &'static SyntaxInfo { | ||
153 | match self { | ||
154 | ERROR => &SyntaxInfo { name: "ERROR" }, | ||
155 | IDENT => &SyntaxInfo { name: "IDENT" }, | ||
156 | UNDERSCORE => &SyntaxInfo { name: "UNDERSCORE" }, | ||
157 | WHITESPACE => &SyntaxInfo { name: "WHITESPACE" }, | ||
158 | INT_NUMBER => &SyntaxInfo { name: "INT_NUMBER" }, | ||
159 | FLOAT_NUMBER => &SyntaxInfo { name: "FLOAT_NUMBER" }, | ||
160 | SEMI => &SyntaxInfo { name: "SEMI" }, | ||
161 | COMMA => &SyntaxInfo { name: "COMMA" }, | ||
162 | DOT => &SyntaxInfo { name: "DOT" }, | ||
163 | DOTDOT => &SyntaxInfo { name: "DOTDOT" }, | ||
164 | DOTDOTDOT => &SyntaxInfo { name: "DOTDOTDOT" }, | ||
165 | DOTDOTEQ => &SyntaxInfo { name: "DOTDOTEQ" }, | ||
166 | L_PAREN => &SyntaxInfo { name: "L_PAREN" }, | ||
167 | R_PAREN => &SyntaxInfo { name: "R_PAREN" }, | ||
168 | L_CURLY => &SyntaxInfo { name: "L_CURLY" }, | ||
169 | R_CURLY => &SyntaxInfo { name: "R_CURLY" }, | ||
170 | L_BRACK => &SyntaxInfo { name: "L_BRACK" }, | ||
171 | R_BRACK => &SyntaxInfo { name: "R_BRACK" }, | ||
172 | L_ANGLE => &SyntaxInfo { name: "L_ANGLE" }, | ||
173 | R_ANGLE => &SyntaxInfo { name: "R_ANGLE" }, | ||
174 | AT => &SyntaxInfo { name: "AT" }, | ||
175 | POUND => &SyntaxInfo { name: "POUND" }, | ||
176 | TILDE => &SyntaxInfo { name: "TILDE" }, | ||
177 | QUESTION => &SyntaxInfo { name: "QUESTION" }, | ||
178 | COLON => &SyntaxInfo { name: "COLON" }, | ||
179 | COLONCOLON => &SyntaxInfo { name: "COLONCOLON" }, | ||
180 | DOLLAR => &SyntaxInfo { name: "DOLLAR" }, | ||
181 | EQ => &SyntaxInfo { name: "EQ" }, | ||
182 | EQEQ => &SyntaxInfo { name: "EQEQ" }, | ||
183 | FAT_ARROW => &SyntaxInfo { name: "FAT_ARROW" }, | ||
184 | NEQ => &SyntaxInfo { name: "NEQ" }, | ||
185 | EXCL => &SyntaxInfo { name: "EXCL" }, | ||
186 | LIFETIME => &SyntaxInfo { name: "LIFETIME" }, | ||
187 | CHAR => &SyntaxInfo { name: "CHAR" }, | ||
188 | BYTE => &SyntaxInfo { name: "BYTE" }, | ||
189 | STRING => &SyntaxInfo { name: "STRING" }, | ||
190 | RAW_STRING => &SyntaxInfo { name: "RAW_STRING" }, | ||
191 | BYTE_STRING => &SyntaxInfo { name: "BYTE_STRING" }, | ||
192 | RAW_BYTE_STRING => &SyntaxInfo { name: "RAW_BYTE_STRING" }, | ||
193 | PLUS => &SyntaxInfo { name: "PLUS" }, | ||
194 | MINUS => &SyntaxInfo { name: "MINUS" }, | ||
195 | STAR => &SyntaxInfo { name: "STAR" }, | ||
196 | SLASH => &SyntaxInfo { name: "SLASH" }, | ||
197 | CARET => &SyntaxInfo { name: "CARET" }, | ||
198 | PERCENT => &SyntaxInfo { name: "PERCENT" }, | ||
199 | AMPERSAND => &SyntaxInfo { name: "AMPERSAND" }, | ||
200 | PIPE => &SyntaxInfo { name: "PIPE" }, | ||
201 | THIN_ARROW => &SyntaxInfo { name: "THIN_ARROW" }, | ||
202 | COMMENT => &SyntaxInfo { name: "COMMENT" }, | ||
203 | DOC_COMMENT => &SyntaxInfo { name: "DOC_COMMENT" }, | ||
204 | SHEBANG => &SyntaxInfo { name: "SHEBANG" }, | ||
205 | USE_KW => &SyntaxInfo { name: "USE_KW" }, | ||
206 | FN_KW => &SyntaxInfo { name: "FN_KW" }, | ||
207 | STRUCT_KW => &SyntaxInfo { name: "STRUCT_KW" }, | ||
208 | ENUM_KW => &SyntaxInfo { name: "ENUM_KW" }, | ||
209 | TRAIT_KW => &SyntaxInfo { name: "TRAIT_KW" }, | ||
210 | IMPL_KW => &SyntaxInfo { name: "IMPL_KW" }, | ||
211 | TRUE_KW => &SyntaxInfo { name: "TRUE_KW" }, | ||
212 | FALSE_KW => &SyntaxInfo { name: "FALSE_KW" }, | ||
213 | AS_KW => &SyntaxInfo { name: "AS_KW" }, | ||
214 | EXTERN_KW => &SyntaxInfo { name: "EXTERN_KW" }, | ||
215 | CRATE_KW => &SyntaxInfo { name: "CRATE_KW" }, | ||
216 | MOD_KW => &SyntaxInfo { name: "MOD_KW" }, | ||
217 | PUB_KW => &SyntaxInfo { name: "PUB_KW" }, | ||
218 | SELF_KW => &SyntaxInfo { name: "SELF_KW" }, | ||
219 | SUPER_KW => &SyntaxInfo { name: "SUPER_KW" }, | ||
220 | IN_KW => &SyntaxInfo { name: "IN_KW" }, | ||
221 | WHERE_KW => &SyntaxInfo { name: "WHERE_KW" }, | ||
222 | FOR_KW => &SyntaxInfo { name: "FOR_KW" }, | ||
223 | LOOP_KW => &SyntaxInfo { name: "LOOP_KW" }, | ||
224 | WHILE_KW => &SyntaxInfo { name: "WHILE_KW" }, | ||
225 | IF_KW => &SyntaxInfo { name: "IF_KW" }, | ||
226 | MATCH_KW => &SyntaxInfo { name: "MATCH_KW" }, | ||
227 | CONST_KW => &SyntaxInfo { name: "CONST_KW" }, | ||
228 | STATIC_KW => &SyntaxInfo { name: "STATIC_KW" }, | ||
229 | MUT_KW => &SyntaxInfo { name: "MUT_KW" }, | ||
230 | UNSAFE_KW => &SyntaxInfo { name: "UNSAFE_KW" }, | ||
231 | TYPE_KW => &SyntaxInfo { name: "TYPE_KW" }, | ||
232 | REF_KW => &SyntaxInfo { name: "REF_KW" }, | ||
233 | LET_KW => &SyntaxInfo { name: "LET_KW" }, | ||
234 | AUTO_KW => &SyntaxInfo { name: "AUTO_KW" }, | ||
235 | DEFAULT_KW => &SyntaxInfo { name: "DEFAULT_KW" }, | ||
236 | UNION_KW => &SyntaxInfo { name: "UNION_KW" }, | ||
237 | FILE => &SyntaxInfo { name: "FILE" }, | ||
238 | STRUCT_ITEM => &SyntaxInfo { name: "STRUCT_ITEM" }, | ||
239 | ENUM_ITEM => &SyntaxInfo { name: "ENUM_ITEM" }, | ||
240 | FN_ITEM => &SyntaxInfo { name: "FN_ITEM" }, | ||
241 | EXTERN_CRATE_ITEM => &SyntaxInfo { name: "EXTERN_CRATE_ITEM" }, | ||
242 | MOD_ITEM => &SyntaxInfo { name: "MOD_ITEM" }, | ||
243 | USE_ITEM => &SyntaxInfo { name: "USE_ITEM" }, | ||
244 | STATIC_ITEM => &SyntaxInfo { name: "STATIC_ITEM" }, | ||
245 | CONST_ITEM => &SyntaxInfo { name: "CONST_ITEM" }, | ||
246 | TRAIT_ITEM => &SyntaxInfo { name: "TRAIT_ITEM" }, | ||
247 | IMPL_ITEM => &SyntaxInfo { name: "IMPL_ITEM" }, | ||
248 | TYPE_ITEM => &SyntaxInfo { name: "TYPE_ITEM" }, | ||
249 | PAREN_TYPE => &SyntaxInfo { name: "PAREN_TYPE" }, | ||
250 | TUPLE_TYPE => &SyntaxInfo { name: "TUPLE_TYPE" }, | ||
251 | NEVER_TYPE => &SyntaxInfo { name: "NEVER_TYPE" }, | ||
252 | PATH_TYPE => &SyntaxInfo { name: "PATH_TYPE" }, | ||
253 | POINTER_TYPE => &SyntaxInfo { name: "POINTER_TYPE" }, | ||
254 | ARRAY_TYPE => &SyntaxInfo { name: "ARRAY_TYPE" }, | ||
255 | SLICE_TYPE => &SyntaxInfo { name: "SLICE_TYPE" }, | ||
256 | REFERENCE_TYPE => &SyntaxInfo { name: "REFERENCE_TYPE" }, | ||
257 | PLACEHOLDER_TYPE => &SyntaxInfo { name: "PLACEHOLDER_TYPE" }, | ||
258 | FN_POINTER_TYPE => &SyntaxInfo { name: "FN_POINTER_TYPE" }, | ||
259 | FOR_TYPE => &SyntaxInfo { name: "FOR_TYPE" }, | ||
260 | REF_PAT => &SyntaxInfo { name: "REF_PAT" }, | ||
261 | BIND_PAT => &SyntaxInfo { name: "BIND_PAT" }, | ||
262 | PLACEHOLDER_PAT => &SyntaxInfo { name: "PLACEHOLDER_PAT" }, | ||
263 | TUPLE_EXPR => &SyntaxInfo { name: "TUPLE_EXPR" }, | ||
264 | EXTERN_BLOCK => &SyntaxInfo { name: "EXTERN_BLOCK" }, | ||
265 | ENUM_VARIANT => &SyntaxInfo { name: "ENUM_VARIANT" }, | ||
266 | NAMED_FIELD => &SyntaxInfo { name: "NAMED_FIELD" }, | ||
267 | POS_FIELD => &SyntaxInfo { name: "POS_FIELD" }, | ||
268 | ATTR => &SyntaxInfo { name: "ATTR" }, | ||
269 | META_ITEM => &SyntaxInfo { name: "META_ITEM" }, | ||
270 | USE_TREE => &SyntaxInfo { name: "USE_TREE" }, | ||
271 | PATH => &SyntaxInfo { name: "PATH" }, | ||
272 | PATH_SEGMENT => &SyntaxInfo { name: "PATH_SEGMENT" }, | ||
273 | LITERAL => &SyntaxInfo { name: "LITERAL" }, | ||
274 | ALIAS => &SyntaxInfo { name: "ALIAS" }, | ||
275 | VISIBILITY => &SyntaxInfo { name: "VISIBILITY" }, | ||
276 | TYPE_PARAM_LIST => &SyntaxInfo { name: "TYPE_PARAM_LIST" }, | ||
277 | WHERE_CLAUSE => &SyntaxInfo { name: "WHERE_CLAUSE" }, | ||
278 | LIFETIME_PARAM => &SyntaxInfo { name: "LIFETIME_PARAM" }, | ||
279 | TYPE_PARAM => &SyntaxInfo { name: "TYPE_PARAM" }, | ||
280 | ABI => &SyntaxInfo { name: "ABI" }, | ||
281 | NAME => &SyntaxInfo { name: "NAME" }, | ||
282 | NAME_REF => &SyntaxInfo { name: "NAME_REF" }, | ||
283 | VALUE_PARAMETER => &SyntaxInfo { name: "VALUE_PARAMETER" }, | ||
284 | BLOCK => &SyntaxInfo { name: "BLOCK" }, | ||
285 | LET_STMT => &SyntaxInfo { name: "LET_STMT" }, | ||
286 | |||
287 | TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" }, | ||
288 | EOF => &SyntaxInfo { name: "EOF" }, | ||
289 | } | ||
290 | } | ||
291 | pub(crate) fn from_keyword(ident: &str) -> Option<SyntaxKind> { | ||
292 | match ident { | ||
293 | "use" => Some(USE_KW), | ||
294 | "fn" => Some(FN_KW), | ||
295 | "struct" => Some(STRUCT_KW), | ||
296 | "enum" => Some(ENUM_KW), | ||
297 | "trait" => Some(TRAIT_KW), | ||
298 | "impl" => Some(IMPL_KW), | ||
299 | "true" => Some(TRUE_KW), | ||
300 | "false" => Some(FALSE_KW), | ||
301 | "as" => Some(AS_KW), | ||
302 | "extern" => Some(EXTERN_KW), | ||
303 | "crate" => Some(CRATE_KW), | ||
304 | "mod" => Some(MOD_KW), | ||
305 | "pub" => Some(PUB_KW), | ||
306 | "self" => Some(SELF_KW), | ||
307 | "super" => Some(SUPER_KW), | ||
308 | "in" => Some(IN_KW), | ||
309 | "where" => Some(WHERE_KW), | ||
310 | "for" => Some(FOR_KW), | ||
311 | "loop" => Some(LOOP_KW), | ||
312 | "while" => Some(WHILE_KW), | ||
313 | "if" => Some(IF_KW), | ||
314 | "match" => Some(MATCH_KW), | ||
315 | "const" => Some(CONST_KW), | ||
316 | "static" => Some(STATIC_KW), | ||
317 | "mut" => Some(MUT_KW), | ||
318 | "unsafe" => Some(UNSAFE_KW), | ||
319 | "type" => Some(TYPE_KW), | ||
320 | "ref" => Some(REF_KW), | ||
321 | "let" => Some(LET_KW), | ||
322 | _ => None, | ||
323 | } | ||
324 | } | ||
325 | } | ||
326 | |||