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 Tsx {
14 End = 0,
15 Identifier = 1,
16 HashBangLine = 2,
17 Export = 3,
18 STAR = 4,
19 Default = 5,
20 Type = 6,
21 EQ = 7,
22 As = 8,
23 Namespace = 9,
24 LBRACE = 10,
25 COMMA = 11,
26 RBRACE = 12,
27 Typeof = 13,
28 Import2 = 14,
29 From = 15,
30 With = 16,
31 Assert = 17,
32 Var = 18,
33 Let = 19,
34 Const = 20,
35 BANG = 21,
36 Else = 22,
37 If = 23,
38 Switch = 24,
39 For = 25,
40 LPAREN = 26,
41 SEMI = 27,
42 RPAREN = 28,
43 Await = 29,
44 In = 30,
45 Of = 31,
46 While = 32,
47 Do = 33,
48 Try = 34,
49 Break = 35,
50 Continue = 36,
51 Debugger = 37,
52 Return = 38,
53 Throw = 39,
54 COLON = 40,
55 Case = 41,
56 Catch = 42,
57 Finally = 43,
58 Yield = 44,
59 LBRACK = 45,
60 RBRACK = 46,
61 HtmlCharacterReference = 47,
62 GT = 48,
63 Identifier2 = 49,
64 DOT = 50,
65 LTSLASH = 51,
66 SLASHGT = 52,
67 DQUOTE = 53,
68 SQUOTE = 54,
69 StringFragment = 55,
70 StringFragment2 = 56,
71 Class2 = 57,
72 Async = 58,
73 Function = 59,
74 EQGT = 60,
75 QMARKDOT = 61,
76 New = 62,
77 Using = 63,
78 PLUSEQ = 64,
79 DASHEQ = 65,
80 STAREQ = 66,
81 SLASHEQ = 67,
82 PERCENTEQ = 68,
83 CARETEQ = 69,
84 AMPEQ = 70,
85 PIPEEQ = 71,
86 GTGTEQ = 72,
87 GTGTGTEQ = 73,
88 LTLTEQ = 74,
89 STARSTAREQ = 75,
90 AMPAMPEQ = 76,
91 PIPEPIPEEQ = 77,
92 QMARKQMARKEQ = 78,
93 DOTDOTDOT = 79,
94 AMPAMP = 80,
95 PIPEPIPE = 81,
96 GTGT = 82,
97 GTGTGT = 83,
98 LTLT = 84,
99 AMP = 85,
100 CARET = 86,
101 PIPE = 87,
102 PLUS = 88,
103 DASH = 89,
104 SLASH = 90,
105 PERCENT = 91,
106 STARSTAR = 92,
107 LT = 93,
108 LTEQ = 94,
109 EQEQ = 95,
110 EQEQEQ = 96,
111 BANGEQ = 97,
112 BANGEQEQ = 98,
113 GTEQ = 99,
114 QMARKQMARK = 100,
115 Instanceof = 101,
116 TILDE = 102,
117 Void = 103,
118 Delete = 104,
119 PLUSPLUS = 105,
120 DASHDASH = 106,
121 StringFragment3 = 107,
122 StringFragment4 = 108,
123 EscapeSequence = 109,
124 Comment = 110,
125 BQUOTE = 111,
126 DOLLARLBRACE = 112,
127 SLASH2 = 113,
128 RegexPattern = 114,
129 RegexFlags = 115,
130 Number = 116,
131 PrivatePropertyIdentifier = 117,
132 Target = 118,
133 Meta = 119,
134 This = 120,
135 Super = 121,
136 True = 122,
137 False = 123,
138 Null = 124,
139 Undefined = 125,
140 AT = 126,
141 Static = 127,
142 Readonly = 128,
143 Get = 129,
144 Set = 130,
145 QMARK = 131,
146 Declare = 132,
147 Public = 133,
148 Private = 134,
149 Protected = 135,
150 Override = 136,
151 Module2 = 137,
152 Any = 138,
153 Number2 = 139,
154 Boolean = 140,
155 String3 = 141,
156 Symbol = 142,
157 Object2 = 143,
158 Abstract = 144,
159 Accessor = 145,
160 Satisfies = 146,
161 Require = 147,
162 Extends = 148,
163 Implements = 149,
164 Global = 150,
165 Interface = 151,
166 Enum = 152,
167 DASHQMARKCOLON = 153,
168 PLUSQMARKCOLON = 154,
169 QMARKCOLON = 155,
170 Asserts2 = 156,
171 Infer = 157,
172 Is = 158,
173 Keyof = 159,
174 Uniquesymbol = 160,
175 Unknown = 161,
176 Never = 162,
177 LBRACEPIPE = 163,
178 PIPERBRACE = 164,
179 AutomaticSemicolon = 165,
180 StringFragment5 = 166,
181 QMARK2 = 167,
182 HtmlComment = 168,
183 JsxText = 169,
184 FunctionSignatureAutomaticSemicolon = 170,
185 ErrorRecovery = 171,
186 Program = 172,
187 ExportStatement = 173,
188 NamespaceExport = 174,
189 ExportClause = 175,
190 ExportSpecifier = 176,
191 ModuleExportName = 177,
192 Declaration = 178,
193 Import = 179,
194 ImportStatement = 180,
195 ImportClause = 181,
196 FromClause = 182,
197 NamespaceImport = 183,
198 NamedImports = 184,
199 ImportSpecifier = 185,
200 ImportAttribute = 186,
201 Statement = 187,
202 ExpressionStatement = 188,
203 VariableDeclaration = 189,
204 LexicalDeclaration = 190,
205 VariableDeclarator = 191,
206 StatementBlock = 192,
207 ElseClause = 193,
208 IfStatement = 194,
209 SwitchStatement = 195,
210 ForStatement = 196,
211 ForInStatement = 197,
212 ForHeader = 198,
213 WhileStatement = 199,
214 DoStatement = 200,
215 TryStatement = 201,
216 WithStatement = 202,
217 BreakStatement = 203,
218 ContinueStatement = 204,
219 DebuggerStatement = 205,
220 ReturnStatement = 206,
221 ThrowStatement = 207,
222 EmptyStatement = 208,
223 LabeledStatement = 209,
224 SwitchBody = 210,
225 SwitchCase = 211,
226 SwitchDefault = 212,
227 CatchClause = 213,
228 FinallyClause = 214,
229 ParenthesizedExpression = 215,
230 Expression = 216,
231 PrimaryExpression = 217,
232 YieldExpression = 218,
233 Object = 219,
234 ObjectPattern = 220,
235 AssignmentPattern = 221,
236 ObjectAssignmentPattern = 222,
237 Array = 223,
238 ArrayPattern = 224,
239 JsxElement = 225,
240 JsxExpression = 226,
241 JsxOpeningElement = 227,
242 NestedIdentifier = 228,
243 JsxNamespaceName = 229,
244 JsxClosingElement = 230,
245 JsxSelfClosingElement = 231,
246 JsxAttribute = 232,
247 String = 233,
248 Class = 234,
249 ClassDeclaration = 235,
250 ClassHeritage = 236,
251 FunctionExpression = 237,
252 FunctionDeclaration = 238,
253 GeneratorFunction = 239,
254 GeneratorFunctionDeclaration = 240,
255 ArrowFunction = 241,
256 CallSignature2 = 242,
257 FormalParameter = 243,
258 OptionalChain = 244,
259 CallExpression = 245,
260 NewExpression = 246,
261 AwaitExpression = 247,
262 MemberExpression = 248,
263 SubscriptExpression = 249,
264 AssignmentExpression = 250,
265 AugmentedAssignmentLhs = 251,
266 AugmentedAssignmentExpression = 252,
267 Initializer = 253,
268 DestructuringPattern = 254,
269 SpreadElement = 255,
270 TernaryExpression = 256,
271 BinaryExpression = 257,
272 UnaryExpression = 258,
273 UpdateExpression = 259,
274 SequenceExpression = 260,
275 String2 = 261,
276 TemplateString = 262,
277 TemplateSubstitution = 263,
278 Regex = 264,
279 MetaProperty = 265,
280 Arguments = 266,
281 Decorator = 267,
282 MemberExpression2 = 268,
283 CallExpression2 = 269,
284 ClassBody = 270,
285 FormalParameters = 271,
286 ClassStaticBlock = 272,
287 Pattern = 273,
288 RestPattern = 274,
289 MethodDefinition = 275,
290 Pair = 276,
291 PairPattern = 277,
292 PropertyName = 278,
293 ComputedPropertyName = 279,
294 PublicFieldDefinition = 280,
295 ImportIdentifier = 281,
296 NonNullExpression = 282,
297 MethodSignature = 283,
298 AbstractMethodSignature = 284,
299 FunctionSignature = 285,
300 ParenthesizedExpression2 = 286,
301 AsExpression = 287,
302 SatisfiesExpression = 288,
303 InstantiationExpression = 289,
304 ImportRequireClause = 290,
305 ExtendsClause = 291,
306 ExtendsClauseSingle = 292,
307 ImplementsClause = 293,
308 AmbientDeclaration = 294,
309 AbstractClassDeclaration = 295,
310 Module = 296,
311 InternalModule = 297,
312 Module3 = 298,
313 ImportAlias = 299,
314 NestedTypeIdentifier = 300,
315 InterfaceDeclaration = 301,
316 ExtendsTypeClause = 302,
317 EnumDeclaration = 303,
318 EnumBody = 304,
319 EnumAssignment = 305,
320 TypeAliasDeclaration = 306,
321 AccessibilityModifier = 307,
322 OverrideModifier = 308,
323 RequiredParameter = 309,
324 OptionalParameter = 310,
325 ParameterName = 311,
326 OmittingTypeAnnotation = 312,
327 AddingTypeAnnotation = 313,
328 OptingTypeAnnotation = 314,
329 TypeAnnotation = 315,
330 MemberExpression3 = 316,
331 CallExpression3 = 317,
332 Asserts = 318,
333 AssertsAnnotation = 319,
334 Type2 = 320,
335 RequiredParameter2 = 321,
336 OptionalParameter2 = 322,
337 OptionalType = 323,
338 RestType = 324,
339 TupleTypeMember = 325,
340 ConstructorType = 326,
341 PrimaryType = 327,
342 TemplateType = 328,
343 TemplateLiteralType = 329,
344 InferType = 330,
345 ConditionalType = 331,
346 GenericType = 332,
347 TypePredicate = 333,
348 TypePredicateAnnotation = 334,
349 MemberExpression4 = 335,
350 SubscriptExpression2 = 336,
351 CallExpression4 = 337,
352 InstantiationExpression2 = 338,
353 TypeQuery = 339,
354 IndexTypeQuery = 340,
355 LookupType = 341,
356 MappedTypeClause = 342,
357 LiteralType = 343,
358 UnaryExpression2 = 344,
359 ExistentialType = 345,
360 FlowMaybeType = 346,
361 ParenthesizedType = 347,
362 PredefinedType = 348,
363 TypeArguments = 349,
364 ObjectType = 350,
365 CallSignature = 351,
366 PropertySignature = 352,
367 TypeParameters = 353,
368 TypeParameter = 354,
369 DefaultType = 355,
370 Constraint = 356,
371 ConstructSignature = 357,
372 IndexSignature = 358,
373 ArrayType = 359,
374 TupleType = 360,
375 ReadonlyType = 361,
376 UnionType = 362,
377 IntersectionType = 363,
378 FunctionType = 364,
379 ProgramRepeat1 = 365,
380 ExportStatementRepeat1 = 366,
381 ExportClauseRepeat1 = 367,
382 NamedImportsRepeat1 = 368,
383 VariableDeclarationRepeat1 = 369,
384 SwitchBodyRepeat1 = 370,
385 ObjectRepeat1 = 371,
386 ObjectPatternRepeat1 = 372,
387 ArrayRepeat1 = 373,
388 ArrayPatternRepeat1 = 374,
389 JsxElementRepeat1 = 375,
390 JsxStringRepeat1 = 376,
391 JsxStringRepeat2 = 377,
392 SequenceExpressionRepeat1 = 378,
393 StringRepeat1 = 379,
394 StringRepeat2 = 380,
395 TemplateStringRepeat1 = 381,
396 ClassBodyRepeat1 = 382,
397 FormalParametersRepeat1 = 383,
398 JsxStartOpeningElementRepeat1 = 384,
399 ExtendsClauseRepeat1 = 385,
400 ImplementsClauseRepeat1 = 386,
401 ExtendsTypeClauseRepeat1 = 387,
402 EnumBodyRepeat1 = 388,
403 TemplateLiteralTypeRepeat1 = 389,
404 ObjectTypeRepeat1 = 390,
405 TypeParametersRepeat1 = 391,
406 TupleTypeRepeat1 = 392,
407 InterfaceBody = 393,
408 PropertyIdentifier = 394,
409 ShorthandPropertyIdentifier = 395,
410 ShorthandPropertyIdentifierPattern = 396,
411 StatementIdentifier = 397,
412 ThisType = 398,
413 TypeIdentifier = 399,
414 Error = 400,
415}
416
417impl From<Tsx> for &'static str {
418 #[inline]
419 fn from(tok: Tsx) -> Self {
420 match tok {
421 Tsx::End => "end",
422 Tsx::Identifier => "identifier",
423 Tsx::HashBangLine => "hash_bang_line",
424 Tsx::Export => "export",
425 Tsx::STAR => "*",
426 Tsx::Default => "default",
427 Tsx::Type => "type",
428 Tsx::EQ => "=",
429 Tsx::As => "as",
430 Tsx::Namespace => "namespace",
431 Tsx::LBRACE => "{",
432 Tsx::COMMA => ",",
433 Tsx::RBRACE => "}",
434 Tsx::Typeof => "typeof",
435 Tsx::Import2 => "import",
436 Tsx::From => "from",
437 Tsx::With => "with",
438 Tsx::Assert => "assert",
439 Tsx::Var => "var",
440 Tsx::Let => "let",
441 Tsx::Const => "const",
442 Tsx::BANG => "!",
443 Tsx::Else => "else",
444 Tsx::If => "if",
445 Tsx::Switch => "switch",
446 Tsx::For => "for",
447 Tsx::LPAREN => "(",
448 Tsx::SEMI => ";",
449 Tsx::RPAREN => ")",
450 Tsx::Await => "await",
451 Tsx::In => "in",
452 Tsx::Of => "of",
453 Tsx::While => "while",
454 Tsx::Do => "do",
455 Tsx::Try => "try",
456 Tsx::Break => "break",
457 Tsx::Continue => "continue",
458 Tsx::Debugger => "debugger",
459 Tsx::Return => "return",
460 Tsx::Throw => "throw",
461 Tsx::COLON => ":",
462 Tsx::Case => "case",
463 Tsx::Catch => "catch",
464 Tsx::Finally => "finally",
465 Tsx::Yield => "yield",
466 Tsx::LBRACK => "[",
467 Tsx::RBRACK => "]",
468 Tsx::HtmlCharacterReference => "html_character_reference",
469 Tsx::GT => ">",
470 Tsx::Identifier2 => "identifier",
471 Tsx::DOT => ".",
472 Tsx::LTSLASH => "</",
473 Tsx::SLASHGT => "/>",
474 Tsx::DQUOTE => "\"",
475 Tsx::SQUOTE => "'",
476 Tsx::StringFragment => "string_fragment",
477 Tsx::StringFragment2 => "string_fragment",
478 Tsx::Class2 => "class",
479 Tsx::Async => "async",
480 Tsx::Function => "function",
481 Tsx::EQGT => "=>",
482 Tsx::QMARKDOT => "?.",
483 Tsx::New => "new",
484 Tsx::Using => "using",
485 Tsx::PLUSEQ => "+=",
486 Tsx::DASHEQ => "-=",
487 Tsx::STAREQ => "*=",
488 Tsx::SLASHEQ => "/=",
489 Tsx::PERCENTEQ => "%=",
490 Tsx::CARETEQ => "^=",
491 Tsx::AMPEQ => "&=",
492 Tsx::PIPEEQ => "|=",
493 Tsx::GTGTEQ => ">>=",
494 Tsx::GTGTGTEQ => ">>>=",
495 Tsx::LTLTEQ => "<<=",
496 Tsx::STARSTAREQ => "**=",
497 Tsx::AMPAMPEQ => "&&=",
498 Tsx::PIPEPIPEEQ => "||=",
499 Tsx::QMARKQMARKEQ => "??=",
500 Tsx::DOTDOTDOT => "...",
501 Tsx::AMPAMP => "&&",
502 Tsx::PIPEPIPE => "||",
503 Tsx::GTGT => ">>",
504 Tsx::GTGTGT => ">>>",
505 Tsx::LTLT => "<<",
506 Tsx::AMP => "&",
507 Tsx::CARET => "^",
508 Tsx::PIPE => "|",
509 Tsx::PLUS => "+",
510 Tsx::DASH => "-",
511 Tsx::SLASH => "/",
512 Tsx::PERCENT => "%",
513 Tsx::STARSTAR => "**",
514 Tsx::LT => "<",
515 Tsx::LTEQ => "<=",
516 Tsx::EQEQ => "==",
517 Tsx::EQEQEQ => "===",
518 Tsx::BANGEQ => "!=",
519 Tsx::BANGEQEQ => "!==",
520 Tsx::GTEQ => ">=",
521 Tsx::QMARKQMARK => "??",
522 Tsx::Instanceof => "instanceof",
523 Tsx::TILDE => "~",
524 Tsx::Void => "void",
525 Tsx::Delete => "delete",
526 Tsx::PLUSPLUS => "++",
527 Tsx::DASHDASH => "--",
528 Tsx::StringFragment3 => "string_fragment",
529 Tsx::StringFragment4 => "string_fragment",
530 Tsx::EscapeSequence => "escape_sequence",
531 Tsx::Comment => "comment",
532 Tsx::BQUOTE => "`",
533 Tsx::DOLLARLBRACE => "${",
534 Tsx::SLASH2 => "/",
535 Tsx::RegexPattern => "regex_pattern",
536 Tsx::RegexFlags => "regex_flags",
537 Tsx::Number => "number",
538 Tsx::PrivatePropertyIdentifier => "private_property_identifier",
539 Tsx::Target => "target",
540 Tsx::Meta => "meta",
541 Tsx::This => "this",
542 Tsx::Super => "super",
543 Tsx::True => "true",
544 Tsx::False => "false",
545 Tsx::Null => "null",
546 Tsx::Undefined => "undefined",
547 Tsx::AT => "@",
548 Tsx::Static => "static",
549 Tsx::Readonly => "readonly",
550 Tsx::Get => "get",
551 Tsx::Set => "set",
552 Tsx::QMARK => "?",
553 Tsx::Declare => "declare",
554 Tsx::Public => "public",
555 Tsx::Private => "private",
556 Tsx::Protected => "protected",
557 Tsx::Override => "override",
558 Tsx::Module2 => "module",
559 Tsx::Any => "any",
560 Tsx::Number2 => "number",
561 Tsx::Boolean => "boolean",
562 Tsx::String3 => "string",
563 Tsx::Symbol => "symbol",
564 Tsx::Object2 => "object",
565 Tsx::Abstract => "abstract",
566 Tsx::Accessor => "accessor",
567 Tsx::Satisfies => "satisfies",
568 Tsx::Require => "require",
569 Tsx::Extends => "extends",
570 Tsx::Implements => "implements",
571 Tsx::Global => "global",
572 Tsx::Interface => "interface",
573 Tsx::Enum => "enum",
574 Tsx::DASHQMARKCOLON => "-?:",
575 Tsx::PLUSQMARKCOLON => "+?:",
576 Tsx::QMARKCOLON => "?:",
577 Tsx::Asserts2 => "asserts",
578 Tsx::Infer => "infer",
579 Tsx::Is => "is",
580 Tsx::Keyof => "keyof",
581 Tsx::Uniquesymbol => "unique symbol",
582 Tsx::Unknown => "unknown",
583 Tsx::Never => "never",
584 Tsx::LBRACEPIPE => "{|",
585 Tsx::PIPERBRACE => "|}",
586 Tsx::AutomaticSemicolon => "_automatic_semicolon",
587 Tsx::StringFragment5 => "string_fragment",
588 Tsx::QMARK2 => "?",
589 Tsx::HtmlComment => "html_comment",
590 Tsx::JsxText => "jsx_text",
591 Tsx::FunctionSignatureAutomaticSemicolon => "_function_signature_automatic_semicolon",
592 Tsx::ErrorRecovery => "__error_recovery",
593 Tsx::Program => "program",
594 Tsx::ExportStatement => "export_statement",
595 Tsx::NamespaceExport => "namespace_export",
596 Tsx::ExportClause => "export_clause",
597 Tsx::ExportSpecifier => "export_specifier",
598 Tsx::ModuleExportName => "_module_export_name",
599 Tsx::Declaration => "declaration",
600 Tsx::Import => "import",
601 Tsx::ImportStatement => "import_statement",
602 Tsx::ImportClause => "import_clause",
603 Tsx::FromClause => "_from_clause",
604 Tsx::NamespaceImport => "namespace_import",
605 Tsx::NamedImports => "named_imports",
606 Tsx::ImportSpecifier => "import_specifier",
607 Tsx::ImportAttribute => "import_attribute",
608 Tsx::Statement => "statement",
609 Tsx::ExpressionStatement => "expression_statement",
610 Tsx::VariableDeclaration => "variable_declaration",
611 Tsx::LexicalDeclaration => "lexical_declaration",
612 Tsx::VariableDeclarator => "variable_declarator",
613 Tsx::StatementBlock => "statement_block",
614 Tsx::ElseClause => "else_clause",
615 Tsx::IfStatement => "if_statement",
616 Tsx::SwitchStatement => "switch_statement",
617 Tsx::ForStatement => "for_statement",
618 Tsx::ForInStatement => "for_in_statement",
619 Tsx::ForHeader => "_for_header",
620 Tsx::WhileStatement => "while_statement",
621 Tsx::DoStatement => "do_statement",
622 Tsx::TryStatement => "try_statement",
623 Tsx::WithStatement => "with_statement",
624 Tsx::BreakStatement => "break_statement",
625 Tsx::ContinueStatement => "continue_statement",
626 Tsx::DebuggerStatement => "debugger_statement",
627 Tsx::ReturnStatement => "return_statement",
628 Tsx::ThrowStatement => "throw_statement",
629 Tsx::EmptyStatement => "empty_statement",
630 Tsx::LabeledStatement => "labeled_statement",
631 Tsx::SwitchBody => "switch_body",
632 Tsx::SwitchCase => "switch_case",
633 Tsx::SwitchDefault => "switch_default",
634 Tsx::CatchClause => "catch_clause",
635 Tsx::FinallyClause => "finally_clause",
636 Tsx::ParenthesizedExpression => "parenthesized_expression",
637 Tsx::Expression => "expression",
638 Tsx::PrimaryExpression => "primary_expression",
639 Tsx::YieldExpression => "yield_expression",
640 Tsx::Object => "object",
641 Tsx::ObjectPattern => "object_pattern",
642 Tsx::AssignmentPattern => "assignment_pattern",
643 Tsx::ObjectAssignmentPattern => "object_assignment_pattern",
644 Tsx::Array => "array",
645 Tsx::ArrayPattern => "array_pattern",
646 Tsx::JsxElement => "jsx_element",
647 Tsx::JsxExpression => "jsx_expression",
648 Tsx::JsxOpeningElement => "jsx_opening_element",
649 Tsx::NestedIdentifier => "nested_identifier",
650 Tsx::JsxNamespaceName => "jsx_namespace_name",
651 Tsx::JsxClosingElement => "jsx_closing_element",
652 Tsx::JsxSelfClosingElement => "jsx_self_closing_element",
653 Tsx::JsxAttribute => "jsx_attribute",
654 Tsx::String => "string",
655 Tsx::Class => "class",
656 Tsx::ClassDeclaration => "class_declaration",
657 Tsx::ClassHeritage => "class_heritage",
658 Tsx::FunctionExpression => "function_expression",
659 Tsx::FunctionDeclaration => "function_declaration",
660 Tsx::GeneratorFunction => "generator_function",
661 Tsx::GeneratorFunctionDeclaration => "generator_function_declaration",
662 Tsx::ArrowFunction => "arrow_function",
663 Tsx::CallSignature2 => "_call_signature",
664 Tsx::FormalParameter => "_formal_parameter",
665 Tsx::OptionalChain => "optional_chain",
666 Tsx::CallExpression => "call_expression",
667 Tsx::NewExpression => "new_expression",
668 Tsx::AwaitExpression => "await_expression",
669 Tsx::MemberExpression => "member_expression",
670 Tsx::SubscriptExpression => "subscript_expression",
671 Tsx::AssignmentExpression => "assignment_expression",
672 Tsx::AugmentedAssignmentLhs => "_augmented_assignment_lhs",
673 Tsx::AugmentedAssignmentExpression => "augmented_assignment_expression",
674 Tsx::Initializer => "_initializer",
675 Tsx::DestructuringPattern => "_destructuring_pattern",
676 Tsx::SpreadElement => "spread_element",
677 Tsx::TernaryExpression => "ternary_expression",
678 Tsx::BinaryExpression => "binary_expression",
679 Tsx::UnaryExpression => "unary_expression",
680 Tsx::UpdateExpression => "update_expression",
681 Tsx::SequenceExpression => "sequence_expression",
682 Tsx::String2 => "string",
683 Tsx::TemplateString => "template_string",
684 Tsx::TemplateSubstitution => "template_substitution",
685 Tsx::Regex => "regex",
686 Tsx::MetaProperty => "meta_property",
687 Tsx::Arguments => "arguments",
688 Tsx::Decorator => "decorator",
689 Tsx::MemberExpression2 => "member_expression",
690 Tsx::CallExpression2 => "call_expression",
691 Tsx::ClassBody => "class_body",
692 Tsx::FormalParameters => "formal_parameters",
693 Tsx::ClassStaticBlock => "class_static_block",
694 Tsx::Pattern => "pattern",
695 Tsx::RestPattern => "rest_pattern",
696 Tsx::MethodDefinition => "method_definition",
697 Tsx::Pair => "pair",
698 Tsx::PairPattern => "pair_pattern",
699 Tsx::PropertyName => "_property_name",
700 Tsx::ComputedPropertyName => "computed_property_name",
701 Tsx::PublicFieldDefinition => "public_field_definition",
702 Tsx::ImportIdentifier => "_import_identifier",
703 Tsx::NonNullExpression => "non_null_expression",
704 Tsx::MethodSignature => "method_signature",
705 Tsx::AbstractMethodSignature => "abstract_method_signature",
706 Tsx::FunctionSignature => "function_signature",
707 Tsx::ParenthesizedExpression2 => "parenthesized_expression",
708 Tsx::AsExpression => "as_expression",
709 Tsx::SatisfiesExpression => "satisfies_expression",
710 Tsx::InstantiationExpression => "instantiation_expression",
711 Tsx::ImportRequireClause => "import_require_clause",
712 Tsx::ExtendsClause => "extends_clause",
713 Tsx::ExtendsClauseSingle => "_extends_clause_single",
714 Tsx::ImplementsClause => "implements_clause",
715 Tsx::AmbientDeclaration => "ambient_declaration",
716 Tsx::AbstractClassDeclaration => "abstract_class_declaration",
717 Tsx::Module => "module",
718 Tsx::InternalModule => "internal_module",
719 Tsx::Module3 => "_module",
720 Tsx::ImportAlias => "import_alias",
721 Tsx::NestedTypeIdentifier => "nested_type_identifier",
722 Tsx::InterfaceDeclaration => "interface_declaration",
723 Tsx::ExtendsTypeClause => "extends_type_clause",
724 Tsx::EnumDeclaration => "enum_declaration",
725 Tsx::EnumBody => "enum_body",
726 Tsx::EnumAssignment => "enum_assignment",
727 Tsx::TypeAliasDeclaration => "type_alias_declaration",
728 Tsx::AccessibilityModifier => "accessibility_modifier",
729 Tsx::OverrideModifier => "override_modifier",
730 Tsx::RequiredParameter => "required_parameter",
731 Tsx::OptionalParameter => "optional_parameter",
732 Tsx::ParameterName => "_parameter_name",
733 Tsx::OmittingTypeAnnotation => "omitting_type_annotation",
734 Tsx::AddingTypeAnnotation => "adding_type_annotation",
735 Tsx::OptingTypeAnnotation => "opting_type_annotation",
736 Tsx::TypeAnnotation => "type_annotation",
737 Tsx::MemberExpression3 => "member_expression",
738 Tsx::CallExpression3 => "call_expression",
739 Tsx::Asserts => "asserts",
740 Tsx::AssertsAnnotation => "asserts_annotation",
741 Tsx::Type2 => "type",
742 Tsx::RequiredParameter2 => "required_parameter",
743 Tsx::OptionalParameter2 => "optional_parameter",
744 Tsx::OptionalType => "optional_type",
745 Tsx::RestType => "rest_type",
746 Tsx::TupleTypeMember => "_tuple_type_member",
747 Tsx::ConstructorType => "constructor_type",
748 Tsx::PrimaryType => "primary_type",
749 Tsx::TemplateType => "template_type",
750 Tsx::TemplateLiteralType => "template_literal_type",
751 Tsx::InferType => "infer_type",
752 Tsx::ConditionalType => "conditional_type",
753 Tsx::GenericType => "generic_type",
754 Tsx::TypePredicate => "type_predicate",
755 Tsx::TypePredicateAnnotation => "type_predicate_annotation",
756 Tsx::MemberExpression4 => "member_expression",
757 Tsx::SubscriptExpression2 => "subscript_expression",
758 Tsx::CallExpression4 => "call_expression",
759 Tsx::InstantiationExpression2 => "instantiation_expression",
760 Tsx::TypeQuery => "type_query",
761 Tsx::IndexTypeQuery => "index_type_query",
762 Tsx::LookupType => "lookup_type",
763 Tsx::MappedTypeClause => "mapped_type_clause",
764 Tsx::LiteralType => "literal_type",
765 Tsx::UnaryExpression2 => "unary_expression",
766 Tsx::ExistentialType => "existential_type",
767 Tsx::FlowMaybeType => "flow_maybe_type",
768 Tsx::ParenthesizedType => "parenthesized_type",
769 Tsx::PredefinedType => "predefined_type",
770 Tsx::TypeArguments => "type_arguments",
771 Tsx::ObjectType => "object_type",
772 Tsx::CallSignature => "call_signature",
773 Tsx::PropertySignature => "property_signature",
774 Tsx::TypeParameters => "type_parameters",
775 Tsx::TypeParameter => "type_parameter",
776 Tsx::DefaultType => "default_type",
777 Tsx::Constraint => "constraint",
778 Tsx::ConstructSignature => "construct_signature",
779 Tsx::IndexSignature => "index_signature",
780 Tsx::ArrayType => "array_type",
781 Tsx::TupleType => "tuple_type",
782 Tsx::ReadonlyType => "readonly_type",
783 Tsx::UnionType => "union_type",
784 Tsx::IntersectionType => "intersection_type",
785 Tsx::FunctionType => "function_type",
786 Tsx::ProgramRepeat1 => "program_repeat1",
787 Tsx::ExportStatementRepeat1 => "export_statement_repeat1",
788 Tsx::ExportClauseRepeat1 => "export_clause_repeat1",
789 Tsx::NamedImportsRepeat1 => "named_imports_repeat1",
790 Tsx::VariableDeclarationRepeat1 => "variable_declaration_repeat1",
791 Tsx::SwitchBodyRepeat1 => "switch_body_repeat1",
792 Tsx::ObjectRepeat1 => "object_repeat1",
793 Tsx::ObjectPatternRepeat1 => "object_pattern_repeat1",
794 Tsx::ArrayRepeat1 => "array_repeat1",
795 Tsx::ArrayPatternRepeat1 => "array_pattern_repeat1",
796 Tsx::JsxElementRepeat1 => "jsx_element_repeat1",
797 Tsx::JsxStringRepeat1 => "_jsx_string_repeat1",
798 Tsx::JsxStringRepeat2 => "_jsx_string_repeat2",
799 Tsx::SequenceExpressionRepeat1 => "sequence_expression_repeat1",
800 Tsx::StringRepeat1 => "string_repeat1",
801 Tsx::StringRepeat2 => "string_repeat2",
802 Tsx::TemplateStringRepeat1 => "template_string_repeat1",
803 Tsx::ClassBodyRepeat1 => "class_body_repeat1",
804 Tsx::FormalParametersRepeat1 => "formal_parameters_repeat1",
805 Tsx::JsxStartOpeningElementRepeat1 => "_jsx_start_opening_element_repeat1",
806 Tsx::ExtendsClauseRepeat1 => "extends_clause_repeat1",
807 Tsx::ImplementsClauseRepeat1 => "implements_clause_repeat1",
808 Tsx::ExtendsTypeClauseRepeat1 => "extends_type_clause_repeat1",
809 Tsx::EnumBodyRepeat1 => "enum_body_repeat1",
810 Tsx::TemplateLiteralTypeRepeat1 => "template_literal_type_repeat1",
811 Tsx::ObjectTypeRepeat1 => "object_type_repeat1",
812 Tsx::TypeParametersRepeat1 => "type_parameters_repeat1",
813 Tsx::TupleTypeRepeat1 => "tuple_type_repeat1",
814 Tsx::InterfaceBody => "interface_body",
815 Tsx::PropertyIdentifier => "property_identifier",
816 Tsx::ShorthandPropertyIdentifier => "shorthand_property_identifier",
817 Tsx::ShorthandPropertyIdentifierPattern => "shorthand_property_identifier_pattern",
818 Tsx::StatementIdentifier => "statement_identifier",
819 Tsx::ThisType => "this_type",
820 Tsx::TypeIdentifier => "type_identifier",
821 Tsx::Error => "ERROR",
822 }
823 }
824}
825
826impl From<u16> for Tsx {
827 #[inline]
828 fn from(x: u16) -> Self {
829 num_traits::FromPrimitive::from_u16(x).unwrap_or(Self::Error)
830 }
831}
832
833impl PartialEq<u16> for Tsx {
835 #[inline]
836 fn eq(&self, x: &u16) -> bool {
837 *self == Into::<Self>::into(*x)
838 }
839}
840
841impl PartialEq<Tsx> for u16 {
843 #[inline]
844 fn eq(&self, x: &Tsx) -> bool {
845 *x == *self
846 }
847}