1#![allow(clippy::match_same_arms, clippy::too_many_lines)]
4#![allow(missing_docs)]
7
8use num_derive::FromPrimitive;
11
12#[derive(Clone, Debug, PartialEq, Eq, FromPrimitive)]
13pub enum Python {
14 End = 0,
15 Identifier = 1,
16 SEMI = 2,
17 Import = 3,
18 DOT = 4,
19 From = 5,
20 Future = 6,
21 LPAREN = 7,
22 RPAREN = 8,
23 COMMA = 9,
24 As = 10,
25 STAR = 11,
26 Print = 12,
27 GTGT = 13,
28 Assert = 14,
29 COLONEQ = 15,
30 Return = 16,
31 Del = 17,
32 Raise = 18,
33 Pass = 19,
34 Break = 20,
35 Continue = 21,
36 If = 22,
37 COLON = 23,
38 Elif = 24,
39 Else = 25,
40 Match = 26,
41 Case = 27,
42 Async = 28,
43 For = 29,
44 In = 30,
45 While = 31,
46 Try = 32,
47 Except = 33,
48 STAR2 = 34,
49 Finally = 35,
50 With = 36,
51 Def = 37,
52 DASHGT = 38,
53 STARSTAR = 39,
54 Global = 40,
55 Nonlocal = 41,
56 Exec = 42,
57 Type2 = 43,
58 EQ = 44,
59 Class = 45,
60 LBRACK = 46,
61 RBRACK = 47,
62 AT = 48,
63 DASH = 49,
64 UNDERSCORE = 50,
65 PIPE = 51,
66 LBRACE = 52,
67 RBRACE = 53,
68 PLUS = 54,
69 Not = 55,
70 And = 56,
71 Or = 57,
72 SLASH = 58,
73 PERCENT = 59,
74 SLASHSLASH = 60,
75 AMP = 61,
76 CARET = 62,
77 LTLT = 63,
78 TILDE = 64,
79 Is = 65,
80 LT = 66,
81 LTEQ = 67,
82 EQEQ = 68,
83 BANGEQ = 69,
84 GTEQ = 70,
85 GT = 71,
86 LTGT = 72,
87 Lambda3 = 73,
88 PLUSEQ = 74,
89 DASHEQ = 75,
90 STAREQ = 76,
91 SLASHEQ = 77,
92 ATEQ = 78,
93 SLASHSLASHEQ = 79,
94 PERCENTEQ = 80,
95 STARSTAREQ = 81,
96 GTGTEQ = 82,
97 LTLTEQ = 83,
98 AMPEQ = 84,
99 CARETEQ = 85,
100 PIPEEQ = 86,
101 Yield2 = 87,
102 Ellipsis = 88,
103 EscapeSequence = 89,
104 BSLASH = 90,
105 FormatSpecifierToken1 = 91,
106 TypeConversion = 92,
107 Integer = 93,
108 Float = 94,
109 Await2 = 95,
110 True = 96,
111 False = 97,
112 None = 98,
113 Comment = 99,
114 LineContinuation = 100,
115 Newline = 101,
116 Indent = 102,
117 Dedent = 103,
118 StringStart = 104,
119 StringContent2 = 105,
120 EscapeInterpolation = 106,
121 StringEnd = 107,
122 Module = 108,
123 Statement = 109,
124 SimpleStatements = 110,
125 ImportStatement = 111,
126 ImportPrefix = 112,
127 RelativeImport = 113,
128 FutureImportStatement = 114,
129 ImportFromStatement = 115,
130 ImportList = 116,
131 AliasedImport = 117,
132 WildcardImport = 118,
133 PrintStatement = 119,
134 Chevron = 120,
135 AssertStatement = 121,
136 ExpressionStatement = 122,
137 NamedExpression = 123,
138 NamedExpressionLhs = 124,
139 ReturnStatement = 125,
140 DeleteStatement = 126,
141 RaiseStatement = 127,
142 PassStatement = 128,
143 BreakStatement = 129,
144 ContinueStatement = 130,
145 IfStatement = 131,
146 ElifClause = 132,
147 ElseClause = 133,
148 MatchStatement = 134,
149 Block = 135,
150 CaseClause = 136,
151 ForStatement = 137,
152 WhileStatement = 138,
153 TryStatement = 139,
154 ExceptClause = 140,
155 FinallyClause = 141,
156 WithStatement = 142,
157 WithClause = 143,
158 WithItem = 144,
159 FunctionDefinition = 145,
160 Parameters = 146,
161 LambdaParameters = 147,
162 ListSplat = 148,
163 DictionarySplat = 149,
164 GlobalStatement = 150,
165 NonlocalStatement = 151,
166 ExecStatement = 152,
167 TypeAliasStatement = 153,
168 ClassDefinition = 154,
169 TypeParameter = 155,
170 ParenthesizedListSplat = 156,
171 ArgumentList = 157,
172 DecoratedDefinition = 158,
173 Decorator = 159,
174 Block2 = 160,
175 ExpressionList = 161,
176 DottedName = 162,
177 CasePattern = 163,
178 SimplePattern = 164,
179 AsPattern = 165,
180 UnionPattern = 166,
181 ListPattern = 167,
182 TuplePattern = 168,
183 DictPattern = 169,
184 KeyValuePattern = 170,
185 KeywordPattern = 171,
186 SplatPattern = 172,
187 ClassPattern = 173,
188 ComplexPattern = 174,
189 Parameters2 = 175,
190 Patterns = 176,
191 Parameter = 177,
192 Pattern = 178,
193 TuplePattern2 = 179,
194 ListPattern2 = 180,
195 DefaultParameter = 181,
196 TypedDefaultParameter = 182,
197 ListSplatPattern = 183,
198 DictionarySplatPattern = 184,
199 AsPattern2 = 185,
200 ExpressionWithinForInClause = 186,
201 Expression = 187,
202 PrimaryExpression = 188,
203 NotOperator = 189,
204 BooleanOperator = 190,
205 BinaryOperator = 191,
206 UnaryOperator = 192,
207 Notin = 193,
208 Isnot = 194,
209 ComparisonOperator = 195,
210 Lambda = 196,
211 Lambda2 = 197,
212 Assignment = 198,
213 AugmentedAssignment = 199,
214 PatternList = 200,
215 RightHandSide = 201,
216 Yield = 202,
217 Attribute = 203,
218 Subscript = 204,
219 Slice = 205,
220 Call = 206,
221 TypedParameter = 207,
222 Type = 208,
223 SplatType = 209,
224 GenericType = 210,
225 UnionType = 211,
226 ConstrainedType = 212,
227 MemberType = 213,
228 KeywordArgument = 214,
229 List = 215,
230 Set = 216,
231 Tuple = 217,
232 Dictionary = 218,
233 Pair = 219,
234 ListComprehension = 220,
235 DictionaryComprehension = 221,
236 SetComprehension = 222,
237 GeneratorExpression = 223,
238 ComprehensionClauses = 224,
239 ParenthesizedExpression = 225,
240 CollectionElements = 226,
241 ForInClause = 227,
242 IfClause = 228,
243 ConditionalExpression = 229,
244 ConcatenatedString = 230,
245 String = 231,
246 StringContent = 232,
247 Interpolation = 233,
248 FExpression = 234,
249 NotEscapeSequence = 235,
250 FormatSpecifier = 236,
251 Await = 237,
252 PositionalSeparator = 238,
253 KeywordSeparator = 239,
254 ModuleRepeat1 = 240,
255 SimpleStatementsRepeat1 = 241,
256 ImportPrefixRepeat1 = 242,
257 ImportListRepeat1 = 243,
258 PrintStatementRepeat1 = 244,
259 AssertStatementRepeat1 = 245,
260 IfStatementRepeat1 = 246,
261 MatchStatementRepeat1 = 247,
262 MatchBlockRepeat1 = 248,
263 CaseClauseRepeat1 = 249,
264 TryStatementRepeat1 = 250,
265 ExceptClauseRepeat1 = 251,
266 WithClauseRepeat1 = 252,
267 GlobalStatementRepeat1 = 253,
268 TypeParameterRepeat1 = 254,
269 ArgumentListRepeat1 = 255,
270 DecoratedDefinitionRepeat1 = 256,
271 DottedNameRepeat1 = 257,
272 UnionPatternRepeat1 = 258,
273 DictPatternRepeat1 = 259,
274 ParametersRepeat1 = 260,
275 PatternsRepeat1 = 261,
276 ComparisonOperatorRepeat1 = 262,
277 SubscriptRepeat1 = 263,
278 DictionaryRepeat1 = 264,
279 ComprehensionClausesRepeat1 = 265,
280 CollectionElementsRepeat1 = 266,
281 ForInClauseRepeat1 = 267,
282 ConcatenatedStringRepeat1 = 268,
283 StringRepeat1 = 269,
284 StringContentRepeat1 = 270,
285 FormatSpecifierRepeat1 = 271,
286 AsPatternTarget = 272,
287 FormatExpression = 273,
288 Error = 274,
289}
290
291pub const PYTHON_KIND_FLAGS: &[(u16, bool, bool)] = &[
296 (0, false, false),
297 (1, true, true),
298 (2, false, true),
299 (3, false, true),
300 (4, false, true),
301 (5, false, true),
302 (6, false, true),
303 (7, false, true),
304 (8, false, true),
305 (9, false, true),
306 (10, false, true),
307 (11, false, true),
308 (12, false, true),
309 (13, false, true),
310 (14, false, true),
311 (15, false, true),
312 (16, false, true),
313 (17, false, true),
314 (18, false, true),
315 (19, false, true),
316 (20, false, true),
317 (21, false, true),
318 (22, false, true),
319 (23, false, true),
320 (24, false, true),
321 (25, false, true),
322 (26, false, true),
323 (27, false, true),
324 (28, false, true),
325 (29, false, true),
326 (30, false, true),
327 (31, false, true),
328 (32, false, true),
329 (33, false, true),
330 (34, false, true),
331 (35, false, true),
332 (36, false, true),
333 (37, false, true),
334 (38, false, true),
335 (39, false, true),
336 (40, false, true),
337 (41, false, true),
338 (42, false, true),
339 (43, false, true),
340 (44, false, true),
341 (45, false, true),
342 (46, false, true),
343 (47, false, true),
344 (48, false, true),
345 (49, false, true),
346 (50, false, true),
347 (51, false, true),
348 (52, false, true),
349 (53, false, true),
350 (54, false, true),
351 (55, false, true),
352 (56, false, true),
353 (57, false, true),
354 (58, false, true),
355 (59, false, true),
356 (60, false, true),
357 (61, false, true),
358 (62, false, true),
359 (63, false, true),
360 (64, false, true),
361 (65, false, true),
362 (66, false, true),
363 (67, false, true),
364 (68, false, true),
365 (69, false, true),
366 (70, false, true),
367 (71, false, true),
368 (72, false, true),
369 (73, false, true),
370 (74, false, true),
371 (75, false, true),
372 (76, false, true),
373 (77, false, true),
374 (78, false, true),
375 (79, false, true),
376 (80, false, true),
377 (81, false, true),
378 (82, false, true),
379 (83, false, true),
380 (84, false, true),
381 (85, false, true),
382 (86, false, true),
383 (87, false, true),
384 (88, true, true),
385 (89, true, true),
386 (90, false, true),
387 (91, false, false),
388 (92, true, true),
389 (93, true, true),
390 (94, true, true),
391 (95, false, true),
392 (96, true, true),
393 (97, true, true),
394 (98, true, true),
395 (99, true, true),
396 (100, true, true),
397 (101, false, false),
398 (102, false, false),
399 (103, false, false),
400 (104, true, true),
401 (105, false, false),
402 (106, true, true),
403 (107, true, true),
404 (108, true, true),
405 (109, false, false),
406 (110, false, false),
407 (111, true, true),
408 (112, true, true),
409 (113, true, true),
410 (114, true, true),
411 (115, true, true),
412 (116, false, false),
413 (117, true, true),
414 (118, true, true),
415 (119, true, true),
416 (120, true, true),
417 (121, true, true),
418 (122, true, true),
419 (123, true, true),
420 (124, false, false),
421 (125, true, true),
422 (126, true, true),
423 (127, true, true),
424 (128, true, true),
425 (129, true, true),
426 (130, true, true),
427 (131, true, true),
428 (132, true, true),
429 (133, true, true),
430 (134, true, true),
431 (135, true, true),
432 (136, true, true),
433 (137, true, true),
434 (138, true, true),
435 (139, true, true),
436 (140, true, true),
437 (141, true, true),
438 (142, true, true),
439 (143, true, true),
440 (144, true, true),
441 (145, true, true),
442 (146, true, true),
443 (147, true, true),
444 (148, true, true),
445 (149, true, true),
446 (150, true, true),
447 (151, true, true),
448 (152, true, true),
449 (153, true, true),
450 (154, true, true),
451 (155, true, true),
452 (156, true, true),
453 (157, true, true),
454 (158, true, true),
455 (159, true, true),
456 (160, true, true),
457 (161, true, true),
458 (162, true, true),
459 (163, true, true),
460 (164, false, false),
461 (165, true, true),
462 (166, true, true),
463 (167, true, true),
464 (168, true, true),
465 (169, true, true),
466 (170, false, false),
467 (171, true, true),
468 (172, true, true),
469 (173, true, true),
470 (174, true, true),
471 (175, false, false),
472 (176, false, false),
473 (177, false, false),
474 (178, false, false),
475 (179, true, true),
476 (180, true, true),
477 (181, true, true),
478 (182, true, true),
479 (183, true, true),
480 (184, true, true),
481 (185, true, true),
482 (186, false, false),
483 (187, false, false),
484 (188, false, false),
485 (189, true, true),
486 (190, true, true),
487 (191, true, true),
488 (192, true, true),
489 (193, false, true),
490 (194, false, true),
491 (195, true, true),
492 (196, true, true),
493 (197, true, true),
494 (198, true, true),
495 (199, true, true),
496 (200, true, true),
497 (201, false, false),
498 (202, true, true),
499 (203, true, true),
500 (204, true, true),
501 (205, true, true),
502 (206, true, true),
503 (207, true, true),
504 (208, true, true),
505 (209, true, true),
506 (210, true, true),
507 (211, true, true),
508 (212, true, true),
509 (213, true, true),
510 (214, true, true),
511 (215, true, true),
512 (216, true, true),
513 (217, true, true),
514 (218, true, true),
515 (219, true, true),
516 (220, true, true),
517 (221, true, true),
518 (222, true, true),
519 (223, true, true),
520 (224, false, false),
521 (225, true, true),
522 (226, false, false),
523 (227, true, true),
524 (228, true, true),
525 (229, true, true),
526 (230, true, true),
527 (231, true, true),
528 (232, true, true),
529 (233, true, true),
530 (234, false, false),
531 (235, false, false),
532 (236, true, true),
533 (237, true, true),
534 (238, true, true),
535 (239, true, true),
536 (240, false, false),
537 (241, false, false),
538 (242, false, false),
539 (243, false, false),
540 (244, false, false),
541 (245, false, false),
542 (246, false, false),
543 (247, false, false),
544 (248, false, false),
545 (249, false, false),
546 (250, false, false),
547 (251, false, false),
548 (252, false, false),
549 (253, false, false),
550 (254, false, false),
551 (255, false, false),
552 (256, false, false),
553 (257, false, false),
554 (258, false, false),
555 (259, false, false),
556 (260, false, false),
557 (261, false, false),
558 (262, false, false),
559 (263, false, false),
560 (264, false, false),
561 (265, false, false),
562 (266, false, false),
563 (267, false, false),
564 (268, false, false),
565 (269, false, false),
566 (270, false, false),
567 (271, false, false),
568 (272, true, true),
569 (273, true, true),
570];
571
572impl From<Python> for &'static str {
573 #[inline]
574 fn from(tok: Python) -> Self {
575 match tok {
576 Python::End => "end",
577 Python::Identifier => "identifier",
578 Python::SEMI => ";",
579 Python::Import => "import",
580 Python::DOT => ".",
581 Python::From => "from",
582 Python::Future => "__future__",
583 Python::LPAREN => "(",
584 Python::RPAREN => ")",
585 Python::COMMA => ",",
586 Python::As => "as",
587 Python::STAR => "*",
588 Python::Print => "print",
589 Python::GTGT => ">>",
590 Python::Assert => "assert",
591 Python::COLONEQ => ":=",
592 Python::Return => "return",
593 Python::Del => "del",
594 Python::Raise => "raise",
595 Python::Pass => "pass",
596 Python::Break => "break",
597 Python::Continue => "continue",
598 Python::If => "if",
599 Python::COLON => ":",
600 Python::Elif => "elif",
601 Python::Else => "else",
602 Python::Match => "match",
603 Python::Case => "case",
604 Python::Async => "async",
605 Python::For => "for",
606 Python::In => "in",
607 Python::While => "while",
608 Python::Try => "try",
609 Python::Except => "except",
610 Python::STAR2 => "*",
611 Python::Finally => "finally",
612 Python::With => "with",
613 Python::Def => "def",
614 Python::DASHGT => "->",
615 Python::STARSTAR => "**",
616 Python::Global => "global",
617 Python::Nonlocal => "nonlocal",
618 Python::Exec => "exec",
619 Python::Type2 => "type",
620 Python::EQ => "=",
621 Python::Class => "class",
622 Python::LBRACK => "[",
623 Python::RBRACK => "]",
624 Python::AT => "@",
625 Python::DASH => "-",
626 Python::UNDERSCORE => "_",
627 Python::PIPE => "|",
628 Python::LBRACE => "{",
629 Python::RBRACE => "}",
630 Python::PLUS => "+",
631 Python::Not => "not",
632 Python::And => "and",
633 Python::Or => "or",
634 Python::SLASH => "/",
635 Python::PERCENT => "%",
636 Python::SLASHSLASH => "//",
637 Python::AMP => "&",
638 Python::CARET => "^",
639 Python::LTLT => "<<",
640 Python::TILDE => "~",
641 Python::Is => "is",
642 Python::LT => "<",
643 Python::LTEQ => "<=",
644 Python::EQEQ => "==",
645 Python::BANGEQ => "!=",
646 Python::GTEQ => ">=",
647 Python::GT => ">",
648 Python::LTGT => "<>",
649 Python::Lambda3 => "lambda",
650 Python::PLUSEQ => "+=",
651 Python::DASHEQ => "-=",
652 Python::STAREQ => "*=",
653 Python::SLASHEQ => "/=",
654 Python::ATEQ => "@=",
655 Python::SLASHSLASHEQ => "//=",
656 Python::PERCENTEQ => "%=",
657 Python::STARSTAREQ => "**=",
658 Python::GTGTEQ => ">>=",
659 Python::LTLTEQ => "<<=",
660 Python::AMPEQ => "&=",
661 Python::CARETEQ => "^=",
662 Python::PIPEEQ => "|=",
663 Python::Yield2 => "yield",
664 Python::Ellipsis => "ellipsis",
665 Python::EscapeSequence => "escape_sequence",
666 Python::BSLASH => "\\",
667 Python::FormatSpecifierToken1 => "format_specifier_token1",
668 Python::TypeConversion => "type_conversion",
669 Python::Integer => "integer",
670 Python::Float => "float",
671 Python::Await2 => "await",
672 Python::True => "true",
673 Python::False => "false",
674 Python::None => "none",
675 Python::Comment => "comment",
676 Python::LineContinuation => "line_continuation",
677 Python::Newline => "_newline",
678 Python::Indent => "_indent",
679 Python::Dedent => "_dedent",
680 Python::StringStart => "string_start",
681 Python::StringContent2 => "_string_content",
682 Python::EscapeInterpolation => "escape_interpolation",
683 Python::StringEnd => "string_end",
684 Python::Module => "module",
685 Python::Statement => "_statement",
686 Python::SimpleStatements => "_simple_statements",
687 Python::ImportStatement => "import_statement",
688 Python::ImportPrefix => "import_prefix",
689 Python::RelativeImport => "relative_import",
690 Python::FutureImportStatement => "future_import_statement",
691 Python::ImportFromStatement => "import_from_statement",
692 Python::ImportList => "_import_list",
693 Python::AliasedImport => "aliased_import",
694 Python::WildcardImport => "wildcard_import",
695 Python::PrintStatement => "print_statement",
696 Python::Chevron => "chevron",
697 Python::AssertStatement => "assert_statement",
698 Python::ExpressionStatement => "expression_statement",
699 Python::NamedExpression => "named_expression",
700 Python::NamedExpressionLhs => "_named_expression_lhs",
701 Python::ReturnStatement => "return_statement",
702 Python::DeleteStatement => "delete_statement",
703 Python::RaiseStatement => "raise_statement",
704 Python::PassStatement => "pass_statement",
705 Python::BreakStatement => "break_statement",
706 Python::ContinueStatement => "continue_statement",
707 Python::IfStatement => "if_statement",
708 Python::ElifClause => "elif_clause",
709 Python::ElseClause => "else_clause",
710 Python::MatchStatement => "match_statement",
711 Python::Block => "block",
712 Python::CaseClause => "case_clause",
713 Python::ForStatement => "for_statement",
714 Python::WhileStatement => "while_statement",
715 Python::TryStatement => "try_statement",
716 Python::ExceptClause => "except_clause",
717 Python::FinallyClause => "finally_clause",
718 Python::WithStatement => "with_statement",
719 Python::WithClause => "with_clause",
720 Python::WithItem => "with_item",
721 Python::FunctionDefinition => "function_definition",
722 Python::Parameters => "parameters",
723 Python::LambdaParameters => "lambda_parameters",
724 Python::ListSplat => "list_splat",
725 Python::DictionarySplat => "dictionary_splat",
726 Python::GlobalStatement => "global_statement",
727 Python::NonlocalStatement => "nonlocal_statement",
728 Python::ExecStatement => "exec_statement",
729 Python::TypeAliasStatement => "type_alias_statement",
730 Python::ClassDefinition => "class_definition",
731 Python::TypeParameter => "type_parameter",
732 Python::ParenthesizedListSplat => "parenthesized_list_splat",
733 Python::ArgumentList => "argument_list",
734 Python::DecoratedDefinition => "decorated_definition",
735 Python::Decorator => "decorator",
736 Python::Block2 => "block",
737 Python::ExpressionList => "expression_list",
738 Python::DottedName => "dotted_name",
739 Python::CasePattern => "case_pattern",
740 Python::SimplePattern => "_simple_pattern",
741 Python::AsPattern => "as_pattern",
742 Python::UnionPattern => "union_pattern",
743 Python::ListPattern => "list_pattern",
744 Python::TuplePattern => "tuple_pattern",
745 Python::DictPattern => "dict_pattern",
746 Python::KeyValuePattern => "_key_value_pattern",
747 Python::KeywordPattern => "keyword_pattern",
748 Python::SplatPattern => "splat_pattern",
749 Python::ClassPattern => "class_pattern",
750 Python::ComplexPattern => "complex_pattern",
751 Python::Parameters2 => "_parameters",
752 Python::Patterns => "_patterns",
753 Python::Parameter => "parameter",
754 Python::Pattern => "pattern",
755 Python::TuplePattern2 => "tuple_pattern",
756 Python::ListPattern2 => "list_pattern",
757 Python::DefaultParameter => "default_parameter",
758 Python::TypedDefaultParameter => "typed_default_parameter",
759 Python::ListSplatPattern => "list_splat_pattern",
760 Python::DictionarySplatPattern => "dictionary_splat_pattern",
761 Python::AsPattern2 => "as_pattern",
762 Python::ExpressionWithinForInClause => "_expression_within_for_in_clause",
763 Python::Expression => "expression",
764 Python::PrimaryExpression => "primary_expression",
765 Python::NotOperator => "not_operator",
766 Python::BooleanOperator => "boolean_operator",
767 Python::BinaryOperator => "binary_operator",
768 Python::UnaryOperator => "unary_operator",
769 Python::Notin => "not in",
770 Python::Isnot => "is not",
771 Python::ComparisonOperator => "comparison_operator",
772 Python::Lambda => "lambda",
773 Python::Lambda2 => "lambda",
774 Python::Assignment => "assignment",
775 Python::AugmentedAssignment => "augmented_assignment",
776 Python::PatternList => "pattern_list",
777 Python::RightHandSide => "_right_hand_side",
778 Python::Yield => "yield",
779 Python::Attribute => "attribute",
780 Python::Subscript => "subscript",
781 Python::Slice => "slice",
782 Python::Call => "call",
783 Python::TypedParameter => "typed_parameter",
784 Python::Type => "type",
785 Python::SplatType => "splat_type",
786 Python::GenericType => "generic_type",
787 Python::UnionType => "union_type",
788 Python::ConstrainedType => "constrained_type",
789 Python::MemberType => "member_type",
790 Python::KeywordArgument => "keyword_argument",
791 Python::List => "list",
792 Python::Set => "set",
793 Python::Tuple => "tuple",
794 Python::Dictionary => "dictionary",
795 Python::Pair => "pair",
796 Python::ListComprehension => "list_comprehension",
797 Python::DictionaryComprehension => "dictionary_comprehension",
798 Python::SetComprehension => "set_comprehension",
799 Python::GeneratorExpression => "generator_expression",
800 Python::ComprehensionClauses => "_comprehension_clauses",
801 Python::ParenthesizedExpression => "parenthesized_expression",
802 Python::CollectionElements => "_collection_elements",
803 Python::ForInClause => "for_in_clause",
804 Python::IfClause => "if_clause",
805 Python::ConditionalExpression => "conditional_expression",
806 Python::ConcatenatedString => "concatenated_string",
807 Python::String => "string",
808 Python::StringContent => "string_content",
809 Python::Interpolation => "interpolation",
810 Python::FExpression => "_f_expression",
811 Python::NotEscapeSequence => "_not_escape_sequence",
812 Python::FormatSpecifier => "format_specifier",
813 Python::Await => "await",
814 Python::PositionalSeparator => "positional_separator",
815 Python::KeywordSeparator => "keyword_separator",
816 Python::ModuleRepeat1 => "module_repeat1",
817 Python::SimpleStatementsRepeat1 => "_simple_statements_repeat1",
818 Python::ImportPrefixRepeat1 => "import_prefix_repeat1",
819 Python::ImportListRepeat1 => "_import_list_repeat1",
820 Python::PrintStatementRepeat1 => "print_statement_repeat1",
821 Python::AssertStatementRepeat1 => "assert_statement_repeat1",
822 Python::IfStatementRepeat1 => "if_statement_repeat1",
823 Python::MatchStatementRepeat1 => "match_statement_repeat1",
824 Python::MatchBlockRepeat1 => "_match_block_repeat1",
825 Python::CaseClauseRepeat1 => "case_clause_repeat1",
826 Python::TryStatementRepeat1 => "try_statement_repeat1",
827 Python::ExceptClauseRepeat1 => "except_clause_repeat1",
828 Python::WithClauseRepeat1 => "with_clause_repeat1",
829 Python::GlobalStatementRepeat1 => "global_statement_repeat1",
830 Python::TypeParameterRepeat1 => "type_parameter_repeat1",
831 Python::ArgumentListRepeat1 => "argument_list_repeat1",
832 Python::DecoratedDefinitionRepeat1 => "decorated_definition_repeat1",
833 Python::DottedNameRepeat1 => "dotted_name_repeat1",
834 Python::UnionPatternRepeat1 => "union_pattern_repeat1",
835 Python::DictPatternRepeat1 => "dict_pattern_repeat1",
836 Python::ParametersRepeat1 => "_parameters_repeat1",
837 Python::PatternsRepeat1 => "_patterns_repeat1",
838 Python::ComparisonOperatorRepeat1 => "comparison_operator_repeat1",
839 Python::SubscriptRepeat1 => "subscript_repeat1",
840 Python::DictionaryRepeat1 => "dictionary_repeat1",
841 Python::ComprehensionClausesRepeat1 => "_comprehension_clauses_repeat1",
842 Python::CollectionElementsRepeat1 => "_collection_elements_repeat1",
843 Python::ForInClauseRepeat1 => "for_in_clause_repeat1",
844 Python::ConcatenatedStringRepeat1 => "concatenated_string_repeat1",
845 Python::StringRepeat1 => "string_repeat1",
846 Python::StringContentRepeat1 => "string_content_repeat1",
847 Python::FormatSpecifierRepeat1 => "format_specifier_repeat1",
848 Python::AsPatternTarget => "as_pattern_target",
849 Python::FormatExpression => "format_expression",
850 Python::Error => "ERROR",
851 }
852 }
853}
854
855impl From<u16> for Python {
856 #[inline]
857 fn from(x: u16) -> Self {
858 num_traits::FromPrimitive::from_u16(x).unwrap_or(Self::Error)
859 }
860}
861
862impl PartialEq<u16> for Python {
864 #[inline]
865 fn eq(&self, x: &u16) -> bool {
866 *self == Into::<Self>::into(*x)
867 }
868}
869
870impl PartialEq<Python> for u16 {
872 #[inline]
873 fn eq(&self, x: &Python) -> bool {
874 *x == *self
875 }
876}