aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/syntax_kinds/generated.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libsyntax2/src/syntax_kinds/generated.rs')
-rw-r--r--crates/libsyntax2/src/syntax_kinds/generated.rs562
1 files changed, 0 insertions, 562 deletions
diff --git a/crates/libsyntax2/src/syntax_kinds/generated.rs b/crates/libsyntax2/src/syntax_kinds/generated.rs
deleted file mode 100644
index 7882bded9..000000000
--- a/crates/libsyntax2/src/syntax_kinds/generated.rs
+++ /dev/null
@@ -1,562 +0,0 @@
1#![allow(bad_style, missing_docs, unreachable_pub)]
2#![cfg_attr(rustfmt, rustfmt_skip)]
3use super::SyntaxInfo;
4
5/// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`.
6#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
7pub enum SyntaxKind {
8 // Technical SyntaxKinds: they appear temporally during parsing,
9 // but never end up in the final tree
10 #[doc(hidden)]
11 TOMBSTONE,
12 #[doc(hidden)]
13 EOF,
14 SEMI,
15 COMMA,
16 L_PAREN,
17 R_PAREN,
18 L_CURLY,
19 R_CURLY,
20 L_BRACK,
21 R_BRACK,
22 L_ANGLE,
23 R_ANGLE,
24 AT,
25 POUND,
26 TILDE,
27 QUESTION,
28 DOLLAR,
29 AMP,
30 PIPE,
31 PLUS,
32 STAR,
33 SLASH,
34 CARET,
35 PERCENT,
36 DOT,
37 DOTDOT,
38 DOTDOTDOT,
39 DOTDOTEQ,
40 COLON,
41 COLONCOLON,
42 EQ,
43 EQEQ,
44 FAT_ARROW,
45 EXCL,
46 NEQ,
47 MINUS,
48 THIN_ARROW,
49 LTEQ,
50 GTEQ,
51 PLUSEQ,
52 MINUSEQ,
53 PIPEEQ,
54 AMPEQ,
55 CARETEQ,
56 SLASHEQ,
57 STAREQ,
58 AMPAMP,
59 PIPEPIPE,
60 SHL,
61 SHR,
62 SHLEQ,
63 SHREQ,
64 USE_KW,
65 FN_KW,
66 STRUCT_KW,
67 ENUM_KW,
68 TRAIT_KW,
69 IMPL_KW,
70 DYN_KW,
71 TRUE_KW,
72 FALSE_KW,
73 AS_KW,
74 EXTERN_KW,
75 CRATE_KW,
76 MOD_KW,
77 PUB_KW,
78 SELF_KW,
79 SUPER_KW,
80 IN_KW,
81 WHERE_KW,
82 FOR_KW,
83 LOOP_KW,
84 WHILE_KW,
85 CONTINUE_KW,
86 BREAK_KW,
87 IF_KW,
88 ELSE_KW,
89 MATCH_KW,
90 CONST_KW,
91 STATIC_KW,
92 MUT_KW,
93 UNSAFE_KW,
94 TYPE_KW,
95 REF_KW,
96 LET_KW,
97 MOVE_KW,
98 RETURN_KW,
99 AUTO_KW,
100 DEFAULT_KW,
101 UNION_KW,
102 ERROR,
103 IDENT,
104 UNDERSCORE,
105 WHITESPACE,
106 INT_NUMBER,
107 FLOAT_NUMBER,
108 LIFETIME,
109 CHAR,
110 BYTE,
111 STRING,
112 RAW_STRING,
113 BYTE_STRING,
114 RAW_BYTE_STRING,
115 COMMENT,
116 DOC_COMMENT,
117 SHEBANG,
118 ROOT,
119 STRUCT_DEF,
120 ENUM_DEF,
121 FN_DEF,
122 RET_TYPE,
123 EXTERN_CRATE_ITEM,
124 MODULE,
125 USE_ITEM,
126 STATIC_DEF,
127 CONST_DEF,
128 TRAIT_DEF,
129 IMPL_ITEM,
130 TYPE_DEF,
131 MACRO_CALL,
132 TOKEN_TREE,
133 PAREN_TYPE,
134 TUPLE_TYPE,
135 NEVER_TYPE,
136 PATH_TYPE,
137 POINTER_TYPE,
138 ARRAY_TYPE,
139 SLICE_TYPE,
140 REFERENCE_TYPE,
141 PLACEHOLDER_TYPE,
142 FN_POINTER_TYPE,
143 FOR_TYPE,
144 IMPL_TRAIT_TYPE,
145 DYN_TRAIT_TYPE,
146 REF_PAT,
147 BIND_PAT,
148 PLACEHOLDER_PAT,
149 PATH_PAT,
150 STRUCT_PAT,
151 FIELD_PAT_LIST,
152 TUPLE_STRUCT_PAT,
153 TUPLE_PAT,
154 SLICE_PAT,
155 RANGE_PAT,
156 TUPLE_EXPR,
157 ARRAY_EXPR,
158 PAREN_EXPR,
159 PATH_EXPR,
160 LAMBDA_EXPR,
161 IF_EXPR,
162 WHILE_EXPR,
163 CONDITION,
164 LOOP_EXPR,
165 FOR_EXPR,
166 CONTINUE_EXPR,
167 BREAK_EXPR,
168 LABEL,
169 BLOCK_EXPR,
170 RETURN_EXPR,
171 MATCH_EXPR,
172 MATCH_ARM_LIST,
173 MATCH_ARM,
174 MATCH_GUARD,
175 STRUCT_LIT,
176 NAMED_FIELD_LIST,
177 NAMED_FIELD,
178 CALL_EXPR,
179 INDEX_EXPR,
180 METHOD_CALL_EXPR,
181 FIELD_EXPR,
182 TRY_EXPR,
183 CAST_EXPR,
184 REF_EXPR,
185 PREFIX_EXPR,
186 RANGE_EXPR,
187 BIN_EXPR,
188 BLOCK,
189 EXTERN_BLOCK,
190 EXTERN_ITEM_LIST,
191 ENUM_VARIANT,
192 NAMED_FIELD_DEF_LIST,
193 NAMED_FIELD_DEF,
194 POS_FIELD_LIST,
195 POS_FIELD,
196 ENUM_VARIANT_LIST,
197 ITEM_LIST,
198 ATTR,
199 META_ITEM,
200 USE_TREE,
201 USE_TREE_LIST,
202 PATH,
203 PATH_SEGMENT,
204 LITERAL,
205 ALIAS,
206 VISIBILITY,
207 WHERE_CLAUSE,
208 WHERE_PRED,
209 ABI,
210 NAME,
211 NAME_REF,
212 LET_STMT,
213 EXPR_STMT,
214 TYPE_PARAM_LIST,
215 LIFETIME_PARAM,
216 TYPE_PARAM,
217 TYPE_ARG_LIST,
218 LIFETIME_ARG,
219 TYPE_ARG,
220 ASSOC_TYPE_ARG,
221 PARAM_LIST,
222 PARAM,
223 SELF_PARAM,
224 ARG_LIST,
225}
226use self::SyntaxKind::*;
227
228impl SyntaxKind {
229 pub fn is_keyword(self) -> bool {
230 match self {
231 | USE_KW
232 | FN_KW
233 | STRUCT_KW
234 | ENUM_KW
235 | TRAIT_KW
236 | IMPL_KW
237 | DYN_KW
238 | TRUE_KW
239 | FALSE_KW
240 | AS_KW
241 | EXTERN_KW
242 | CRATE_KW
243 | MOD_KW
244 | PUB_KW
245 | SELF_KW
246 | SUPER_KW
247 | IN_KW
248 | WHERE_KW
249 | FOR_KW
250 | LOOP_KW
251 | WHILE_KW
252 | CONTINUE_KW
253 | BREAK_KW
254 | IF_KW
255 | ELSE_KW
256 | MATCH_KW
257 | CONST_KW
258 | STATIC_KW
259 | MUT_KW
260 | UNSAFE_KW
261 | TYPE_KW
262 | REF_KW
263 | LET_KW
264 | MOVE_KW
265 | RETURN_KW
266 | AUTO_KW
267 | DEFAULT_KW
268 | UNION_KW
269 => true,
270 _ => false
271 }
272 }
273
274 pub(crate) fn info(self) -> &'static SyntaxInfo {
275 match self {
276 SEMI => &SyntaxInfo { name: "SEMI" },
277 COMMA => &SyntaxInfo { name: "COMMA" },
278 L_PAREN => &SyntaxInfo { name: "L_PAREN" },
279 R_PAREN => &SyntaxInfo { name: "R_PAREN" },
280 L_CURLY => &SyntaxInfo { name: "L_CURLY" },
281 R_CURLY => &SyntaxInfo { name: "R_CURLY" },
282 L_BRACK => &SyntaxInfo { name: "L_BRACK" },
283 R_BRACK => &SyntaxInfo { name: "R_BRACK" },
284 L_ANGLE => &SyntaxInfo { name: "L_ANGLE" },
285 R_ANGLE => &SyntaxInfo { name: "R_ANGLE" },
286 AT => &SyntaxInfo { name: "AT" },
287 POUND => &SyntaxInfo { name: "POUND" },
288 TILDE => &SyntaxInfo { name: "TILDE" },
289 QUESTION => &SyntaxInfo { name: "QUESTION" },
290 DOLLAR => &SyntaxInfo { name: "DOLLAR" },
291 AMP => &SyntaxInfo { name: "AMP" },
292 PIPE => &SyntaxInfo { name: "PIPE" },
293 PLUS => &SyntaxInfo { name: "PLUS" },
294 STAR => &SyntaxInfo { name: "STAR" },
295 SLASH => &SyntaxInfo { name: "SLASH" },
296 CARET => &SyntaxInfo { name: "CARET" },
297 PERCENT => &SyntaxInfo { name: "PERCENT" },
298 DOT => &SyntaxInfo { name: "DOT" },
299 DOTDOT => &SyntaxInfo { name: "DOTDOT" },
300 DOTDOTDOT => &SyntaxInfo { name: "DOTDOTDOT" },
301 DOTDOTEQ => &SyntaxInfo { name: "DOTDOTEQ" },
302 COLON => &SyntaxInfo { name: "COLON" },
303 COLONCOLON => &SyntaxInfo { name: "COLONCOLON" },
304 EQ => &SyntaxInfo { name: "EQ" },
305 EQEQ => &SyntaxInfo { name: "EQEQ" },
306 FAT_ARROW => &SyntaxInfo { name: "FAT_ARROW" },
307 EXCL => &SyntaxInfo { name: "EXCL" },
308 NEQ => &SyntaxInfo { name: "NEQ" },
309 MINUS => &SyntaxInfo { name: "MINUS" },
310 THIN_ARROW => &SyntaxInfo { name: "THIN_ARROW" },
311 LTEQ => &SyntaxInfo { name: "LTEQ" },
312 GTEQ => &SyntaxInfo { name: "GTEQ" },
313 PLUSEQ => &SyntaxInfo { name: "PLUSEQ" },
314 MINUSEQ => &SyntaxInfo { name: "MINUSEQ" },
315 PIPEEQ => &SyntaxInfo { name: "PIPEEQ" },
316 AMPEQ => &SyntaxInfo { name: "AMPEQ" },
317 CARETEQ => &SyntaxInfo { name: "CARETEQ" },
318 SLASHEQ => &SyntaxInfo { name: "SLASHEQ" },
319 STAREQ => &SyntaxInfo { name: "STAREQ" },
320 AMPAMP => &SyntaxInfo { name: "AMPAMP" },
321 PIPEPIPE => &SyntaxInfo { name: "PIPEPIPE" },
322 SHL => &SyntaxInfo { name: "SHL" },
323 SHR => &SyntaxInfo { name: "SHR" },
324 SHLEQ => &SyntaxInfo { name: "SHLEQ" },
325 SHREQ => &SyntaxInfo { name: "SHREQ" },
326 USE_KW => &SyntaxInfo { name: "USE_KW" },
327 FN_KW => &SyntaxInfo { name: "FN_KW" },
328 STRUCT_KW => &SyntaxInfo { name: "STRUCT_KW" },
329 ENUM_KW => &SyntaxInfo { name: "ENUM_KW" },
330 TRAIT_KW => &SyntaxInfo { name: "TRAIT_KW" },
331 IMPL_KW => &SyntaxInfo { name: "IMPL_KW" },
332 DYN_KW => &SyntaxInfo { name: "DYN_KW" },
333 TRUE_KW => &SyntaxInfo { name: "TRUE_KW" },
334 FALSE_KW => &SyntaxInfo { name: "FALSE_KW" },
335 AS_KW => &SyntaxInfo { name: "AS_KW" },
336 EXTERN_KW => &SyntaxInfo { name: "EXTERN_KW" },
337 CRATE_KW => &SyntaxInfo { name: "CRATE_KW" },
338 MOD_KW => &SyntaxInfo { name: "MOD_KW" },
339 PUB_KW => &SyntaxInfo { name: "PUB_KW" },
340 SELF_KW => &SyntaxInfo { name: "SELF_KW" },
341 SUPER_KW => &SyntaxInfo { name: "SUPER_KW" },
342 IN_KW => &SyntaxInfo { name: "IN_KW" },
343 WHERE_KW => &SyntaxInfo { name: "WHERE_KW" },
344 FOR_KW => &SyntaxInfo { name: "FOR_KW" },
345 LOOP_KW => &SyntaxInfo { name: "LOOP_KW" },
346 WHILE_KW => &SyntaxInfo { name: "WHILE_KW" },
347 CONTINUE_KW => &SyntaxInfo { name: "CONTINUE_KW" },
348 BREAK_KW => &SyntaxInfo { name: "BREAK_KW" },
349 IF_KW => &SyntaxInfo { name: "IF_KW" },
350 ELSE_KW => &SyntaxInfo { name: "ELSE_KW" },
351 MATCH_KW => &SyntaxInfo { name: "MATCH_KW" },
352 CONST_KW => &SyntaxInfo { name: "CONST_KW" },
353 STATIC_KW => &SyntaxInfo { name: "STATIC_KW" },
354 MUT_KW => &SyntaxInfo { name: "MUT_KW" },
355 UNSAFE_KW => &SyntaxInfo { name: "UNSAFE_KW" },
356 TYPE_KW => &SyntaxInfo { name: "TYPE_KW" },
357 REF_KW => &SyntaxInfo { name: "REF_KW" },
358 LET_KW => &SyntaxInfo { name: "LET_KW" },
359 MOVE_KW => &SyntaxInfo { name: "MOVE_KW" },
360 RETURN_KW => &SyntaxInfo { name: "RETURN_KW" },
361 AUTO_KW => &SyntaxInfo { name: "AUTO_KW" },
362 DEFAULT_KW => &SyntaxInfo { name: "DEFAULT_KW" },
363 UNION_KW => &SyntaxInfo { name: "UNION_KW" },
364 ERROR => &SyntaxInfo { name: "ERROR" },
365 IDENT => &SyntaxInfo { name: "IDENT" },
366 UNDERSCORE => &SyntaxInfo { name: "UNDERSCORE" },
367 WHITESPACE => &SyntaxInfo { name: "WHITESPACE" },
368 INT_NUMBER => &SyntaxInfo { name: "INT_NUMBER" },
369 FLOAT_NUMBER => &SyntaxInfo { name: "FLOAT_NUMBER" },
370 LIFETIME => &SyntaxInfo { name: "LIFETIME" },
371 CHAR => &SyntaxInfo { name: "CHAR" },
372 BYTE => &SyntaxInfo { name: "BYTE" },
373 STRING => &SyntaxInfo { name: "STRING" },
374 RAW_STRING => &SyntaxInfo { name: "RAW_STRING" },
375 BYTE_STRING => &SyntaxInfo { name: "BYTE_STRING" },
376 RAW_BYTE_STRING => &SyntaxInfo { name: "RAW_BYTE_STRING" },
377 COMMENT => &SyntaxInfo { name: "COMMENT" },
378 DOC_COMMENT => &SyntaxInfo { name: "DOC_COMMENT" },
379 SHEBANG => &SyntaxInfo { name: "SHEBANG" },
380 ROOT => &SyntaxInfo { name: "ROOT" },
381 STRUCT_DEF => &SyntaxInfo { name: "STRUCT_DEF" },
382 ENUM_DEF => &SyntaxInfo { name: "ENUM_DEF" },
383 FN_DEF => &SyntaxInfo { name: "FN_DEF" },
384 RET_TYPE => &SyntaxInfo { name: "RET_TYPE" },
385 EXTERN_CRATE_ITEM => &SyntaxInfo { name: "EXTERN_CRATE_ITEM" },
386 MODULE => &SyntaxInfo { name: "MODULE" },
387 USE_ITEM => &SyntaxInfo { name: "USE_ITEM" },
388 STATIC_DEF => &SyntaxInfo { name: "STATIC_DEF" },
389 CONST_DEF => &SyntaxInfo { name: "CONST_DEF" },
390 TRAIT_DEF => &SyntaxInfo { name: "TRAIT_DEF" },
391 IMPL_ITEM => &SyntaxInfo { name: "IMPL_ITEM" },
392 TYPE_DEF => &SyntaxInfo { name: "TYPE_DEF" },
393 MACRO_CALL => &SyntaxInfo { name: "MACRO_CALL" },
394 TOKEN_TREE => &SyntaxInfo { name: "TOKEN_TREE" },
395 PAREN_TYPE => &SyntaxInfo { name: "PAREN_TYPE" },
396 TUPLE_TYPE => &SyntaxInfo { name: "TUPLE_TYPE" },
397 NEVER_TYPE => &SyntaxInfo { name: "NEVER_TYPE" },
398 PATH_TYPE => &SyntaxInfo { name: "PATH_TYPE" },
399 POINTER_TYPE => &SyntaxInfo { name: "POINTER_TYPE" },
400 ARRAY_TYPE => &SyntaxInfo { name: "ARRAY_TYPE" },
401 SLICE_TYPE => &SyntaxInfo { name: "SLICE_TYPE" },
402 REFERENCE_TYPE => &SyntaxInfo { name: "REFERENCE_TYPE" },
403 PLACEHOLDER_TYPE => &SyntaxInfo { name: "PLACEHOLDER_TYPE" },
404 FN_POINTER_TYPE => &SyntaxInfo { name: "FN_POINTER_TYPE" },
405 FOR_TYPE => &SyntaxInfo { name: "FOR_TYPE" },
406 IMPL_TRAIT_TYPE => &SyntaxInfo { name: "IMPL_TRAIT_TYPE" },
407 DYN_TRAIT_TYPE => &SyntaxInfo { name: "DYN_TRAIT_TYPE" },
408 REF_PAT => &SyntaxInfo { name: "REF_PAT" },
409 BIND_PAT => &SyntaxInfo { name: "BIND_PAT" },
410 PLACEHOLDER_PAT => &SyntaxInfo { name: "PLACEHOLDER_PAT" },
411 PATH_PAT => &SyntaxInfo { name: "PATH_PAT" },
412 STRUCT_PAT => &SyntaxInfo { name: "STRUCT_PAT" },
413 FIELD_PAT_LIST => &SyntaxInfo { name: "FIELD_PAT_LIST" },
414 TUPLE_STRUCT_PAT => &SyntaxInfo { name: "TUPLE_STRUCT_PAT" },
415 TUPLE_PAT => &SyntaxInfo { name: "TUPLE_PAT" },
416 SLICE_PAT => &SyntaxInfo { name: "SLICE_PAT" },
417 RANGE_PAT => &SyntaxInfo { name: "RANGE_PAT" },
418 TUPLE_EXPR => &SyntaxInfo { name: "TUPLE_EXPR" },
419 ARRAY_EXPR => &SyntaxInfo { name: "ARRAY_EXPR" },
420 PAREN_EXPR => &SyntaxInfo { name: "PAREN_EXPR" },
421 PATH_EXPR => &SyntaxInfo { name: "PATH_EXPR" },
422 LAMBDA_EXPR => &SyntaxInfo { name: "LAMBDA_EXPR" },
423 IF_EXPR => &SyntaxInfo { name: "IF_EXPR" },
424 WHILE_EXPR => &SyntaxInfo { name: "WHILE_EXPR" },
425 CONDITION => &SyntaxInfo { name: "CONDITION" },
426 LOOP_EXPR => &SyntaxInfo { name: "LOOP_EXPR" },
427 FOR_EXPR => &SyntaxInfo { name: "FOR_EXPR" },
428 CONTINUE_EXPR => &SyntaxInfo { name: "CONTINUE_EXPR" },
429 BREAK_EXPR => &SyntaxInfo { name: "BREAK_EXPR" },
430 LABEL => &SyntaxInfo { name: "LABEL" },
431 BLOCK_EXPR => &SyntaxInfo { name: "BLOCK_EXPR" },
432 RETURN_EXPR => &SyntaxInfo { name: "RETURN_EXPR" },
433 MATCH_EXPR => &SyntaxInfo { name: "MATCH_EXPR" },
434 MATCH_ARM_LIST => &SyntaxInfo { name: "MATCH_ARM_LIST" },
435 MATCH_ARM => &SyntaxInfo { name: "MATCH_ARM" },
436 MATCH_GUARD => &SyntaxInfo { name: "MATCH_GUARD" },
437 STRUCT_LIT => &SyntaxInfo { name: "STRUCT_LIT" },
438 NAMED_FIELD_LIST => &SyntaxInfo { name: "NAMED_FIELD_LIST" },
439 NAMED_FIELD => &SyntaxInfo { name: "NAMED_FIELD" },
440 CALL_EXPR => &SyntaxInfo { name: "CALL_EXPR" },
441 INDEX_EXPR => &SyntaxInfo { name: "INDEX_EXPR" },
442 METHOD_CALL_EXPR => &SyntaxInfo { name: "METHOD_CALL_EXPR" },
443 FIELD_EXPR => &SyntaxInfo { name: "FIELD_EXPR" },
444 TRY_EXPR => &SyntaxInfo { name: "TRY_EXPR" },
445 CAST_EXPR => &SyntaxInfo { name: "CAST_EXPR" },
446 REF_EXPR => &SyntaxInfo { name: "REF_EXPR" },
447 PREFIX_EXPR => &SyntaxInfo { name: "PREFIX_EXPR" },
448 RANGE_EXPR => &SyntaxInfo { name: "RANGE_EXPR" },
449 BIN_EXPR => &SyntaxInfo { name: "BIN_EXPR" },
450 BLOCK => &SyntaxInfo { name: "BLOCK" },
451 EXTERN_BLOCK => &SyntaxInfo { name: "EXTERN_BLOCK" },
452 EXTERN_ITEM_LIST => &SyntaxInfo { name: "EXTERN_ITEM_LIST" },
453 ENUM_VARIANT => &SyntaxInfo { name: "ENUM_VARIANT" },
454 NAMED_FIELD_DEF_LIST => &SyntaxInfo { name: "NAMED_FIELD_DEF_LIST" },
455 NAMED_FIELD_DEF => &SyntaxInfo { name: "NAMED_FIELD_DEF" },
456 POS_FIELD_LIST => &SyntaxInfo { name: "POS_FIELD_LIST" },
457 POS_FIELD => &SyntaxInfo { name: "POS_FIELD" },
458 ENUM_VARIANT_LIST => &SyntaxInfo { name: "ENUM_VARIANT_LIST" },
459 ITEM_LIST => &SyntaxInfo { name: "ITEM_LIST" },
460 ATTR => &SyntaxInfo { name: "ATTR" },
461 META_ITEM => &SyntaxInfo { name: "META_ITEM" },
462 USE_TREE => &SyntaxInfo { name: "USE_TREE" },
463 USE_TREE_LIST => &SyntaxInfo { name: "USE_TREE_LIST" },
464 PATH => &SyntaxInfo { name: "PATH" },
465 PATH_SEGMENT => &SyntaxInfo { name: "PATH_SEGMENT" },
466 LITERAL => &SyntaxInfo { name: "LITERAL" },
467 ALIAS => &SyntaxInfo { name: "ALIAS" },
468 VISIBILITY => &SyntaxInfo { name: "VISIBILITY" },
469 WHERE_CLAUSE => &SyntaxInfo { name: "WHERE_CLAUSE" },
470 WHERE_PRED => &SyntaxInfo { name: "WHERE_PRED" },
471 ABI => &SyntaxInfo { name: "ABI" },
472 NAME => &SyntaxInfo { name: "NAME" },
473 NAME_REF => &SyntaxInfo { name: "NAME_REF" },
474 LET_STMT => &SyntaxInfo { name: "LET_STMT" },
475 EXPR_STMT => &SyntaxInfo { name: "EXPR_STMT" },
476 TYPE_PARAM_LIST => &SyntaxInfo { name: "TYPE_PARAM_LIST" },
477 LIFETIME_PARAM => &SyntaxInfo { name: "LIFETIME_PARAM" },
478 TYPE_PARAM => &SyntaxInfo { name: "TYPE_PARAM" },
479 TYPE_ARG_LIST => &SyntaxInfo { name: "TYPE_ARG_LIST" },
480 LIFETIME_ARG => &SyntaxInfo { name: "LIFETIME_ARG" },
481 TYPE_ARG => &SyntaxInfo { name: "TYPE_ARG" },
482 ASSOC_TYPE_ARG => &SyntaxInfo { name: "ASSOC_TYPE_ARG" },
483 PARAM_LIST => &SyntaxInfo { name: "PARAM_LIST" },
484 PARAM => &SyntaxInfo { name: "PARAM" },
485 SELF_PARAM => &SyntaxInfo { name: "SELF_PARAM" },
486 ARG_LIST => &SyntaxInfo { name: "ARG_LIST" },
487 TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" },
488 EOF => &SyntaxInfo { name: "EOF" },
489 }
490 }
491 pub(crate) fn from_keyword(ident: &str) -> Option<SyntaxKind> {
492 let kw = match ident {
493 "use" => USE_KW,
494 "fn" => FN_KW,
495 "struct" => STRUCT_KW,
496 "enum" => ENUM_KW,
497 "trait" => TRAIT_KW,
498 "impl" => IMPL_KW,
499 "dyn" => DYN_KW,
500 "true" => TRUE_KW,
501 "false" => FALSE_KW,
502 "as" => AS_KW,
503 "extern" => EXTERN_KW,
504 "crate" => CRATE_KW,
505 "mod" => MOD_KW,
506 "pub" => PUB_KW,
507 "self" => SELF_KW,
508 "super" => SUPER_KW,
509 "in" => IN_KW,
510 "where" => WHERE_KW,
511 "for" => FOR_KW,
512 "loop" => LOOP_KW,
513 "while" => WHILE_KW,
514 "continue" => CONTINUE_KW,
515 "break" => BREAK_KW,
516 "if" => IF_KW,
517 "else" => ELSE_KW,
518 "match" => MATCH_KW,
519 "const" => CONST_KW,
520 "static" => STATIC_KW,
521 "mut" => MUT_KW,
522 "unsafe" => UNSAFE_KW,
523 "type" => TYPE_KW,
524 "ref" => REF_KW,
525 "let" => LET_KW,
526 "move" => MOVE_KW,
527 "return" => RETURN_KW,
528 _ => return None,
529 };
530 Some(kw)
531 }
532
533 pub(crate) fn from_char(c: char) -> Option<SyntaxKind> {
534 let tok = match c {
535 ';' => SEMI,
536 ',' => COMMA,
537 '(' => L_PAREN,
538 ')' => R_PAREN,
539 '{' => L_CURLY,
540 '}' => R_CURLY,
541 '[' => L_BRACK,
542 ']' => R_BRACK,
543 '<' => L_ANGLE,
544 '>' => R_ANGLE,
545 '@' => AT,
546 '#' => POUND,
547 '~' => TILDE,
548 '?' => QUESTION,
549 '$' => DOLLAR,
550 '&' => AMP,
551 '|' => PIPE,
552 '+' => PLUS,
553 '*' => STAR,
554 '/' => SLASH,
555 '^' => CARET,
556 '%' => PERCENT,
557 _ => return None,
558 };
559 Some(tok)
560 }
561}
562