rust-code-analysis 0.0.18

Tool to compute and export code metrics
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
// Code generated; DO NOT EDIT.

#[derive(Clone, Debug, PartialEq)]
pub enum Typescript {
    End = 0,
    Identifier = 1,
    HashBangLine = 2,
    Export = 3,
    STAR = 4,
    Default = 5,
    EQ = 6,
    As = 7,
    Namespace = 8,
    LBRACE = 9,
    COMMA = 10,
    RBRACE = 11,
    Type2 = 12,
    Typeof = 13,
    Import2 = 14,
    From = 15,
    Var = 16,
    Let = 17,
    Const = 18,
    If = 19,
    Else = 20,
    Switch = 21,
    For = 22,
    LPAREN = 23,
    RPAREN = 24,
    Await = 25,
    In = 26,
    Of = 27,
    While = 28,
    Do = 29,
    Try = 30,
    With = 31,
    Break = 32,
    Continue = 33,
    Debugger = 34,
    Return = 35,
    Throw = 36,
    SEMI = 37,
    COLON = 38,
    Case = 39,
    Catch = 40,
    Finally = 41,
    Yield = 42,
    LBRACK = 43,
    RBRACK = 44,
    LT = 45,
    GT = 46,
    SLASH = 47,
    DOT = 48,
    Class2 = 49,
    Async = 50,
    Function2 = 51,
    EQGT = 52,
    New = 53,
    PLUSEQ = 54,
    DASHEQ = 55,
    STAREQ = 56,
    SLASHEQ = 57,
    PERCENTEQ = 58,
    CARETEQ = 59,
    AMPEQ = 60,
    PIPEEQ = 61,
    GTGTEQ = 62,
    GTGTGTEQ = 63,
    LTLTEQ = 64,
    STARSTAREQ = 65,
    DOTDOTDOT = 66,
    QMARK = 67,
    AMPAMP = 68,
    PIPEPIPE = 69,
    GTGT = 70,
    GTGTGT = 71,
    LTLT = 72,
    AMP = 73,
    CARET = 74,
    PIPE = 75,
    PLUS = 76,
    DASH = 77,
    PERCENT = 78,
    STARSTAR = 79,
    LTEQ = 80,
    EQEQ = 81,
    EQEQEQ = 82,
    BANGEQ = 83,
    BANGEQEQ = 84,
    GTEQ = 85,
    QMARKQMARK = 86,
    Instanceof = 87,
    BANG = 88,
    TILDE = 89,
    Void = 90,
    Delete = 91,
    PLUSPLUS = 92,
    DASHDASH = 93,
    DQUOTE = 94,
    StringToken1 = 95,
    SQUOTE = 96,
    StringToken2 = 97,
    EscapeSequence = 98,
    Comment = 99,
    BQUOTE = 100,
    DOLLARLBRACE = 101,
    SLASH2 = 102,
    RegexPattern = 103,
    RegexFlags = 104,
    Number = 105,
    Target = 106,
    This = 107,
    Super = 108,
    True = 109,
    False = 110,
    Null = 111,
    Undefined = 112,
    AT = 113,
    Static = 114,
    Abstract = 115,
    Get = 116,
    Set = 117,
    Declare = 118,
    Public = 119,
    Private = 120,
    Protected = 121,
    Module3 = 122,
    Any = 123,
    Number2 = 124,
    Boolean = 125,
    String2 = 126,
    Symbol = 127,
    Require = 128,
    Implements = 129,
    Global = 130,
    Interface = 131,
    Extends = 132,
    Enum = 133,
    Readonly = 134,
    Is = 135,
    Keyof = 136,
    LBRACEPIPE = 137,
    PIPERBRACE = 138,
    AutomaticSemicolon = 139,
    TemplateChars = 140,
    Program = 141,
    ExportStatement = 142,
    ExportClause = 143,
    ImportExportSpecifier = 144,
    Declaration = 145,
    Import = 146,
    ImportStatement = 147,
    ImportClause = 148,
    FromClause = 149,
    NamespaceImport = 150,
    NamedImports = 151,
    ExpressionStatement = 152,
    VariableDeclaration = 153,
    LexicalDeclaration = 154,
    VariableDeclarator = 155,
    StatementBlock = 156,
    IfStatement = 157,
    SwitchStatement = 158,
    ForStatement = 159,
    ForInStatement = 160,
    ForHeader = 161,
    WhileStatement = 162,
    DoStatement = 163,
    TryStatement = 164,
    WithStatement = 165,
    BreakStatement = 166,
    ContinueStatement = 167,
    DebuggerStatement = 168,
    ReturnStatement = 169,
    ThrowStatement = 170,
    EmptyStatement = 171,
    LabeledStatement = 172,
    SwitchBody = 173,
    SwitchCase = 174,
    SwitchDefault = 175,
    CatchClause = 176,
    FinallyClause = 177,
    ParenthesizedExpression = 178,
    Expression = 179,
    YieldExpression = 180,
    Object = 181,
    AssignmentPattern = 182,
    Array = 183,
    NestedIdentifier = 184,
    Class = 185,
    ClassDeclaration = 186,
    ClassHeritage = 187,
    Function = 188,
    FunctionDeclaration = 189,
    GeneratorFunction = 190,
    GeneratorFunctionDeclaration = 191,
    ArrowFunction = 192,
    CallSignature = 193,
    CallExpression = 194,
    NewExpression = 195,
    AwaitExpression = 196,
    MemberExpression = 197,
    SubscriptExpression = 198,
    AssignmentExpression = 199,
    AugmentedAssignmentExpression = 200,
    Initializer = 201,
    SpreadElement = 202,
    TernaryExpression = 203,
    BinaryExpression = 204,
    UnaryExpression = 205,
    UpdateExpression = 206,
    SequenceExpression = 207,
    String = 208,
    TemplateString = 209,
    TemplateSubstitution = 210,
    Regex = 211,
    MetaProperty = 212,
    Arguments = 213,
    Decorator = 214,
    MemberExpression2 = 215,
    CallExpression2 = 216,
    ClassBody = 217,
    PublicFieldDefinition = 218,
    FormalParameters = 219,
    RestParameter = 220,
    MethodDefinition = 221,
    Pair = 222,
    PropertyName = 223,
    ComputedPropertyName = 224,
    NonNullExpression = 225,
    MethodSignature = 226,
    AbstractMethodSignature = 227,
    FunctionSignature = 228,
    TypeAssertion = 229,
    AsExpression = 230,
    ImportRequireClause = 231,
    ImplementsClause = 232,
    AmbientDeclaration = 233,
    AbstractClassDeclaration = 234,
    Module = 235,
    InternalModule = 236,
    Module2 = 237,
    ImportAlias = 238,
    NestedTypeIdentifier = 239,
    InterfaceDeclaration = 240,
    ExtendsClause = 241,
    EnumDeclaration = 242,
    EnumBody = 243,
    EnumAssignment = 244,
    TypeAliasDeclaration = 245,
    AccessibilityModifier = 246,
    RequiredParameter = 247,
    OptionalParameter = 248,
    ParameterName = 249,
    TypeAnnotation = 250,
    Type = 251,
    ConstructorType = 252,
    PrimaryType = 253,
    GenericType = 254,
    TypePredicate = 255,
    TypeQuery = 256,
    IndexTypeQuery = 257,
    LookupType = 258,
    MappedTypeClause = 259,
    LiteralType = 260,
    UnaryExpression2 = 261,
    ExistentialType = 262,
    FlowMaybeType = 263,
    ParenthesizedType = 264,
    PredefinedType = 265,
    TypeArguments = 266,
    ObjectType = 267,
    CallSignature2 = 268,
    PropertySignature = 269,
    TypeParameters = 270,
    TypeParameter = 271,
    DefaultType = 272,
    Constraint = 273,
    ConstructSignature = 274,
    IndexSignature = 275,
    ArrayType = 276,
    TupleType = 277,
    UnionType = 278,
    IntersectionType = 279,
    FunctionType = 280,
    ProgramRepeat1 = 281,
    ExportStatementRepeat1 = 282,
    ExportClauseRepeat1 = 283,
    NamedImportsRepeat1 = 284,
    VariableDeclarationRepeat1 = 285,
    SwitchBodyRepeat1 = 286,
    ObjectRepeat1 = 287,
    ArrayRepeat1 = 288,
    StringRepeat1 = 289,
    StringRepeat2 = 290,
    TemplateStringRepeat1 = 291,
    ClassBodyRepeat1 = 292,
    FormalParametersRepeat1 = 293,
    ImplementsClauseRepeat1 = 294,
    ExtendsClauseRepeat1 = 295,
    EnumBodyRepeat1 = 296,
    ObjectTypeRepeat1 = 297,
    TypeParametersRepeat1 = 298,
    ArrayPattern = 299,
    ExportSpecifier = 300,
    ImportSpecifier = 301,
    ObjectPattern = 302,
    PropertyIdentifier = 303,
    ShorthandPropertyIdentifier = 304,
    StatementIdentifier = 305,
    TypeIdentifier = 306,
    Error = 307,
}

impl Into<&'static str> for Typescript {
    fn into(self) -> &'static str {
        match self {
            Typescript::End => "end",
            Typescript::Identifier => "identifier",
            Typescript::HashBangLine => "hash_bang_line",
            Typescript::Export => "export",
            Typescript::STAR => "*",
            Typescript::Default => "default",
            Typescript::EQ => "=",
            Typescript::As => "as",
            Typescript::Namespace => "namespace",
            Typescript::LBRACE => "{",
            Typescript::COMMA => ",",
            Typescript::RBRACE => "}",
            Typescript::Type2 => "type",
            Typescript::Typeof => "typeof",
            Typescript::Import2 => "import",
            Typescript::From => "from",
            Typescript::Var => "var",
            Typescript::Let => "let",
            Typescript::Const => "const",
            Typescript::If => "if",
            Typescript::Else => "else",
            Typescript::Switch => "switch",
            Typescript::For => "for",
            Typescript::LPAREN => "(",
            Typescript::RPAREN => ")",
            Typescript::Await => "await",
            Typescript::In => "in",
            Typescript::Of => "of",
            Typescript::While => "while",
            Typescript::Do => "do",
            Typescript::Try => "try",
            Typescript::With => "with",
            Typescript::Break => "break",
            Typescript::Continue => "continue",
            Typescript::Debugger => "debugger",
            Typescript::Return => "return",
            Typescript::Throw => "throw",
            Typescript::SEMI => ";",
            Typescript::COLON => ":",
            Typescript::Case => "case",
            Typescript::Catch => "catch",
            Typescript::Finally => "finally",
            Typescript::Yield => "yield",
            Typescript::LBRACK => "[",
            Typescript::RBRACK => "]",
            Typescript::LT => "<",
            Typescript::GT => ">",
            Typescript::SLASH => "/",
            Typescript::DOT => ".",
            Typescript::Class2 => "class",
            Typescript::Async => "async",
            Typescript::Function2 => "function",
            Typescript::EQGT => "=>",
            Typescript::New => "new",
            Typescript::PLUSEQ => "+=",
            Typescript::DASHEQ => "-=",
            Typescript::STAREQ => "*=",
            Typescript::SLASHEQ => "/=",
            Typescript::PERCENTEQ => "%=",
            Typescript::CARETEQ => "^=",
            Typescript::AMPEQ => "&=",
            Typescript::PIPEEQ => "|=",
            Typescript::GTGTEQ => ">>=",
            Typescript::GTGTGTEQ => ">>>=",
            Typescript::LTLTEQ => "<<=",
            Typescript::STARSTAREQ => "**=",
            Typescript::DOTDOTDOT => "...",
            Typescript::QMARK => "?",
            Typescript::AMPAMP => "&&",
            Typescript::PIPEPIPE => "||",
            Typescript::GTGT => ">>",
            Typescript::GTGTGT => ">>>",
            Typescript::LTLT => "<<",
            Typescript::AMP => "&",
            Typescript::CARET => "^",
            Typescript::PIPE => "|",
            Typescript::PLUS => "+",
            Typescript::DASH => "-",
            Typescript::PERCENT => "%",
            Typescript::STARSTAR => "**",
            Typescript::LTEQ => "<=",
            Typescript::EQEQ => "==",
            Typescript::EQEQEQ => "===",
            Typescript::BANGEQ => "!=",
            Typescript::BANGEQEQ => "!==",
            Typescript::GTEQ => ">=",
            Typescript::QMARKQMARK => "??",
            Typescript::Instanceof => "instanceof",
            Typescript::BANG => "!",
            Typescript::TILDE => "~",
            Typescript::Void => "void",
            Typescript::Delete => "delete",
            Typescript::PLUSPLUS => "++",
            Typescript::DASHDASH => "--",
            Typescript::DQUOTE => "\"",
            Typescript::StringToken1 => "string_token1",
            Typescript::SQUOTE => "'",
            Typescript::StringToken2 => "string_token2",
            Typescript::EscapeSequence => "escape_sequence",
            Typescript::Comment => "comment",
            Typescript::BQUOTE => "`",
            Typescript::DOLLARLBRACE => "${",
            Typescript::SLASH2 => "/",
            Typescript::RegexPattern => "regex_pattern",
            Typescript::RegexFlags => "regex_flags",
            Typescript::Number => "number",
            Typescript::Target => "target",
            Typescript::This => "this",
            Typescript::Super => "super",
            Typescript::True => "true",
            Typescript::False => "false",
            Typescript::Null => "null",
            Typescript::Undefined => "undefined",
            Typescript::AT => "@",
            Typescript::Static => "static",
            Typescript::Abstract => "abstract",
            Typescript::Get => "get",
            Typescript::Set => "set",
            Typescript::Declare => "declare",
            Typescript::Public => "public",
            Typescript::Private => "private",
            Typescript::Protected => "protected",
            Typescript::Module3 => "module",
            Typescript::Any => "any",
            Typescript::Number2 => "number",
            Typescript::Boolean => "boolean",
            Typescript::String2 => "string",
            Typescript::Symbol => "symbol",
            Typescript::Require => "require",
            Typescript::Implements => "implements",
            Typescript::Global => "global",
            Typescript::Interface => "interface",
            Typescript::Extends => "extends",
            Typescript::Enum => "enum",
            Typescript::Readonly => "readonly",
            Typescript::Is => "is",
            Typescript::Keyof => "keyof",
            Typescript::LBRACEPIPE => "{|",
            Typescript::PIPERBRACE => "|}",
            Typescript::AutomaticSemicolon => "_automatic_semicolon",
            Typescript::TemplateChars => "_template_chars",
            Typescript::Program => "program",
            Typescript::ExportStatement => "export_statement",
            Typescript::ExportClause => "export_clause",
            Typescript::ImportExportSpecifier => "_import_export_specifier",
            Typescript::Declaration => "_declaration",
            Typescript::Import => "import",
            Typescript::ImportStatement => "import_statement",
            Typescript::ImportClause => "import_clause",
            Typescript::FromClause => "_from_clause",
            Typescript::NamespaceImport => "namespace_import",
            Typescript::NamedImports => "named_imports",
            Typescript::ExpressionStatement => "expression_statement",
            Typescript::VariableDeclaration => "variable_declaration",
            Typescript::LexicalDeclaration => "lexical_declaration",
            Typescript::VariableDeclarator => "variable_declarator",
            Typescript::StatementBlock => "statement_block",
            Typescript::IfStatement => "if_statement",
            Typescript::SwitchStatement => "switch_statement",
            Typescript::ForStatement => "for_statement",
            Typescript::ForInStatement => "for_in_statement",
            Typescript::ForHeader => "_for_header",
            Typescript::WhileStatement => "while_statement",
            Typescript::DoStatement => "do_statement",
            Typescript::TryStatement => "try_statement",
            Typescript::WithStatement => "with_statement",
            Typescript::BreakStatement => "break_statement",
            Typescript::ContinueStatement => "continue_statement",
            Typescript::DebuggerStatement => "debugger_statement",
            Typescript::ReturnStatement => "return_statement",
            Typescript::ThrowStatement => "throw_statement",
            Typescript::EmptyStatement => "empty_statement",
            Typescript::LabeledStatement => "labeled_statement",
            Typescript::SwitchBody => "switch_body",
            Typescript::SwitchCase => "switch_case",
            Typescript::SwitchDefault => "switch_default",
            Typescript::CatchClause => "catch_clause",
            Typescript::FinallyClause => "finally_clause",
            Typescript::ParenthesizedExpression => "parenthesized_expression",
            Typescript::Expression => "_expression",
            Typescript::YieldExpression => "yield_expression",
            Typescript::Object => "object",
            Typescript::AssignmentPattern => "assignment_pattern",
            Typescript::Array => "array",
            Typescript::NestedIdentifier => "nested_identifier",
            Typescript::Class => "class",
            Typescript::ClassDeclaration => "class_declaration",
            Typescript::ClassHeritage => "class_heritage",
            Typescript::Function => "function",
            Typescript::FunctionDeclaration => "function_declaration",
            Typescript::GeneratorFunction => "generator_function",
            Typescript::GeneratorFunctionDeclaration => "generator_function_declaration",
            Typescript::ArrowFunction => "arrow_function",
            Typescript::CallSignature => "_call_signature",
            Typescript::CallExpression => "call_expression",
            Typescript::NewExpression => "new_expression",
            Typescript::AwaitExpression => "await_expression",
            Typescript::MemberExpression => "member_expression",
            Typescript::SubscriptExpression => "subscript_expression",
            Typescript::AssignmentExpression => "assignment_expression",
            Typescript::AugmentedAssignmentExpression => "augmented_assignment_expression",
            Typescript::Initializer => "_initializer",
            Typescript::SpreadElement => "spread_element",
            Typescript::TernaryExpression => "ternary_expression",
            Typescript::BinaryExpression => "binary_expression",
            Typescript::UnaryExpression => "unary_expression",
            Typescript::UpdateExpression => "update_expression",
            Typescript::SequenceExpression => "sequence_expression",
            Typescript::String => "string",
            Typescript::TemplateString => "template_string",
            Typescript::TemplateSubstitution => "template_substitution",
            Typescript::Regex => "regex",
            Typescript::MetaProperty => "meta_property",
            Typescript::Arguments => "arguments",
            Typescript::Decorator => "decorator",
            Typescript::MemberExpression2 => "member_expression",
            Typescript::CallExpression2 => "call_expression",
            Typescript::ClassBody => "class_body",
            Typescript::PublicFieldDefinition => "public_field_definition",
            Typescript::FormalParameters => "formal_parameters",
            Typescript::RestParameter => "rest_parameter",
            Typescript::MethodDefinition => "method_definition",
            Typescript::Pair => "pair",
            Typescript::PropertyName => "_property_name",
            Typescript::ComputedPropertyName => "computed_property_name",
            Typescript::NonNullExpression => "non_null_expression",
            Typescript::MethodSignature => "method_signature",
            Typescript::AbstractMethodSignature => "abstract_method_signature",
            Typescript::FunctionSignature => "function_signature",
            Typescript::TypeAssertion => "type_assertion",
            Typescript::AsExpression => "as_expression",
            Typescript::ImportRequireClause => "import_require_clause",
            Typescript::ImplementsClause => "implements_clause",
            Typescript::AmbientDeclaration => "ambient_declaration",
            Typescript::AbstractClassDeclaration => "abstract_class_declaration",
            Typescript::Module => "module",
            Typescript::InternalModule => "internal_module",
            Typescript::Module2 => "_module",
            Typescript::ImportAlias => "import_alias",
            Typescript::NestedTypeIdentifier => "nested_type_identifier",
            Typescript::InterfaceDeclaration => "interface_declaration",
            Typescript::ExtendsClause => "extends_clause",
            Typescript::EnumDeclaration => "enum_declaration",
            Typescript::EnumBody => "enum_body",
            Typescript::EnumAssignment => "enum_assignment",
            Typescript::TypeAliasDeclaration => "type_alias_declaration",
            Typescript::AccessibilityModifier => "accessibility_modifier",
            Typescript::RequiredParameter => "required_parameter",
            Typescript::OptionalParameter => "optional_parameter",
            Typescript::ParameterName => "_parameter_name",
            Typescript::TypeAnnotation => "type_annotation",
            Typescript::Type => "_type",
            Typescript::ConstructorType => "constructor_type",
            Typescript::PrimaryType => "_primary_type",
            Typescript::GenericType => "generic_type",
            Typescript::TypePredicate => "type_predicate",
            Typescript::TypeQuery => "type_query",
            Typescript::IndexTypeQuery => "index_type_query",
            Typescript::LookupType => "lookup_type",
            Typescript::MappedTypeClause => "mapped_type_clause",
            Typescript::LiteralType => "literal_type",
            Typescript::UnaryExpression2 => "unary_expression",
            Typescript::ExistentialType => "existential_type",
            Typescript::FlowMaybeType => "flow_maybe_type",
            Typescript::ParenthesizedType => "parenthesized_type",
            Typescript::PredefinedType => "predefined_type",
            Typescript::TypeArguments => "type_arguments",
            Typescript::ObjectType => "object_type",
            Typescript::CallSignature2 => "call_signature",
            Typescript::PropertySignature => "property_signature",
            Typescript::TypeParameters => "type_parameters",
            Typescript::TypeParameter => "type_parameter",
            Typescript::DefaultType => "default_type",
            Typescript::Constraint => "constraint",
            Typescript::ConstructSignature => "construct_signature",
            Typescript::IndexSignature => "index_signature",
            Typescript::ArrayType => "array_type",
            Typescript::TupleType => "tuple_type",
            Typescript::UnionType => "union_type",
            Typescript::IntersectionType => "intersection_type",
            Typescript::FunctionType => "function_type",
            Typescript::ProgramRepeat1 => "program_repeat1",
            Typescript::ExportStatementRepeat1 => "export_statement_repeat1",
            Typescript::ExportClauseRepeat1 => "export_clause_repeat1",
            Typescript::NamedImportsRepeat1 => "named_imports_repeat1",
            Typescript::VariableDeclarationRepeat1 => "variable_declaration_repeat1",
            Typescript::SwitchBodyRepeat1 => "switch_body_repeat1",
            Typescript::ObjectRepeat1 => "object_repeat1",
            Typescript::ArrayRepeat1 => "array_repeat1",
            Typescript::StringRepeat1 => "string_repeat1",
            Typescript::StringRepeat2 => "string_repeat2",
            Typescript::TemplateStringRepeat1 => "template_string_repeat1",
            Typescript::ClassBodyRepeat1 => "class_body_repeat1",
            Typescript::FormalParametersRepeat1 => "formal_parameters_repeat1",
            Typescript::ImplementsClauseRepeat1 => "implements_clause_repeat1",
            Typescript::ExtendsClauseRepeat1 => "extends_clause_repeat1",
            Typescript::EnumBodyRepeat1 => "enum_body_repeat1",
            Typescript::ObjectTypeRepeat1 => "object_type_repeat1",
            Typescript::TypeParametersRepeat1 => "type_parameters_repeat1",
            Typescript::ArrayPattern => "array_pattern",
            Typescript::ExportSpecifier => "export_specifier",
            Typescript::ImportSpecifier => "import_specifier",
            Typescript::ObjectPattern => "object_pattern",
            Typescript::PropertyIdentifier => "property_identifier",
            Typescript::ShorthandPropertyIdentifier => "shorthand_property_identifier",
            Typescript::StatementIdentifier => "statement_identifier",
            Typescript::TypeIdentifier => "type_identifier",
            Typescript::Error => "ERROR",
        }
    }
}

#[allow(clippy::unreadable_literal)]
static KEYS: phf::Map<&'static str, Typescript> = ::phf::Map {
    key: 3213172566270843353,
    disps: ::phf::Slice::Static(&[
        (1, 114),
        (0, 4),
        (0, 249),
        (0, 0),
        (3, 275),
        (0, 164),
        (0, 9),
        (0, 1),
        (2, 25),
        (7, 153),
        (0, 9),
        (0, 11),
        (1, 119),
        (1, 80),
        (0, 24),
        (1, 167),
        (7, 167),
        (0, 45),
        (0, 155),
        (1, 191),
        (0, 2),
        (0, 236),
        (0, 20),
        (0, 20),
        (0, 2),
        (2, 34),
        (4, 217),
        (0, 0),
        (3, 280),
        (0, 209),
        (0, 51),
        (3, 52),
        (0, 0),
        (29, 186),
        (0, 164),
        (12, 222),
        (0, 40),
        (0, 3),
        (0, 9),
        (1, 5),
        (4, 290),
        (9, 150),
        (0, 168),
        (0, 61),
        (0, 41),
        (2, 227),
        (0, 38),
        (2, 186),
        (18, 144),
        (1, 157),
        (0, 0),
        (19, 281),
        (0, 29),
        (0, 193),
        (0, 103),
        (1, 1),
        (0, 0),
        (0, 268),
        (0, 35),
    ]),
    entries: ::phf::Slice::Static(&[
        ("public", Typescript::Public),
        ("_automatic_semicolon", Typescript::AutomaticSemicolon),
        ("array_pattern", Typescript::ArrayPattern),
        ("{|", Typescript::LBRACEPIPE),
        ("accessibility_modifier", Typescript::AccessibilityModifier),
        ("statement_block", Typescript::StatementBlock),
        ("[", Typescript::LBRACK),
        ("intersection_type", Typescript::IntersectionType),
        ("existential_type", Typescript::ExistentialType),
        ("type_query", Typescript::TypeQuery),
        ("import_clause", Typescript::ImportClause),
        ("type_assertion", Typescript::TypeAssertion),
        ("new_expression", Typescript::NewExpression),
        ("switch_case", Typescript::SwitchCase),
        ("type_arguments", Typescript::TypeArguments),
        ("export_statement", Typescript::ExportStatement),
        ("if_statement", Typescript::IfStatement),
        ("pair", Typescript::Pair),
        ("meta_property", Typescript::MetaProperty),
        ("null", Typescript::Null),
        ("if", Typescript::If),
        ("hash_bang_line", Typescript::HashBangLine),
        ("return_statement", Typescript::ReturnStatement),
        ("&", Typescript::AMP),
        ("break", Typescript::Break),
        ("||", Typescript::PIPEPIPE),
        ("try_statement", Typescript::TryStatement),
        ("function_signature", Typescript::FunctionSignature),
        ("import", Typescript::Import),
        ("yield_expression", Typescript::YieldExpression),
        ("generator_function", Typescript::GeneratorFunction),
        ("export_clause_repeat1", Typescript::ExportClauseRepeat1),
        ("lookup_type", Typescript::LookupType),
        ("!=", Typescript::BANGEQ),
        ("implements_clause", Typescript::ImplementsClause),
        ("export_specifier", Typescript::ExportSpecifier),
        ("<", Typescript::LT),
        ("assignment_pattern", Typescript::AssignmentPattern),
        ("abstract", Typescript::Abstract),
        ("%", Typescript::PERCENT),
        ("(", Typescript::LPAREN),
        ("\\\"", Typescript::DQUOTE),
        ("enum_body", Typescript::EnumBody),
        ("@", Typescript::AT),
        ("string", Typescript::String),
        ("export_clause", Typescript::ExportClause),
        ("|=", Typescript::PIPEEQ),
        ("unary_expression", Typescript::UnaryExpression),
        ("tuple_type", Typescript::TupleType),
        ("template_string", Typescript::TemplateString),
        ("is", Typescript::Is),
        ("var", Typescript::Var),
        (
            "parenthesized_expression",
            Typescript::ParenthesizedExpression,
        ),
        ("get", Typescript::Get),
        ("identifier", Typescript::Identifier),
        ("declare", Typescript::Declare),
        ("method_definition", Typescript::MethodDefinition),
        ("{", Typescript::LBRACE),
        ("switch_body", Typescript::SwitchBody),
        ("array_repeat1", Typescript::ArrayRepeat1),
        ("target", Typescript::Target),
        ("else", Typescript::Else),
        (">=", Typescript::GTEQ),
        ("catch_clause", Typescript::CatchClause),
        ("construct_signature", Typescript::ConstructSignature),
        ("as_expression", Typescript::AsExpression),
        ("in", Typescript::In),
        ("escape_sequence", Typescript::EscapeSequence),
        ("super", Typescript::Super),
        ("await_expression", Typescript::AwaitExpression),
        ("yield", Typescript::Yield),
        ("catch", Typescript::Catch),
        ("predefined_type", Typescript::PredefinedType),
        ("ternary_expression", Typescript::TernaryExpression),
        ("of", Typescript::Of),
        ("_type", Typescript::Type),
        ("+", Typescript::PLUS),
        ("array", Typescript::Array),
        (
            "shorthand_property_identifier",
            Typescript::ShorthandPropertyIdentifier,
        ),
        ("function", Typescript::Function),
        ("number", Typescript::Number),
        ("enum_declaration", Typescript::EnumDeclaration),
        ("-=", Typescript::DASHEQ),
        ("_from_clause", Typescript::FromClause),
        ("-", Typescript::DASH),
        ("optional_parameter", Typescript::OptionalParameter),
        ("default", Typescript::Default),
        ("from", Typescript::From),
        ("class_body_repeat1", Typescript::ClassBodyRepeat1),
        ("array_type", Typescript::ArrayType),
        ("|", Typescript::PIPE),
        ("require", Typescript::Require),
        ("^=", Typescript::CARETEQ),
        ("end", Typescript::End),
        (
            "formal_parameters_repeat1",
            Typescript::FormalParametersRepeat1,
        ),
        ("*=", Typescript::STAREQ),
        ("class_body", Typescript::ClassBody),
        ("enum_assignment", Typescript::EnumAssignment),
        ("!", Typescript::BANG),
        ("index_type_query", Typescript::IndexTypeQuery),
        ("any", Typescript::Any),
        ("void", Typescript::Void),
        (
            "generator_function_declaration",
            Typescript::GeneratorFunctionDeclaration,
        ),
        (
            "implements_clause_repeat1",
            Typescript::ImplementsClauseRepeat1,
        ),
        ("type_identifier", Typescript::TypeIdentifier),
        ("as", Typescript::As),
        ("rest_parameter", Typescript::RestParameter),
        (
            "abstract_method_signature",
            Typescript::AbstractMethodSignature,
        ),
        ("nested_type_identifier", Typescript::NestedTypeIdentifier),
        ("return", Typescript::Return),
        ("formal_parameters", Typescript::FormalParameters),
        ("object_type", Typescript::ObjectType),
        ("${", Typescript::DOLLARLBRACE),
        ("with_statement", Typescript::WithStatement),
        ("break_statement", Typescript::BreakStatement),
        (">>>=", Typescript::GTGTGTEQ),
        ("type_predicate", Typescript::TypePredicate),
        ("=>", Typescript::EQGT),
        ("false", Typescript::False),
        ("}", Typescript::RBRACE),
        ("computed_property_name", Typescript::ComputedPropertyName),
        ("constraint", Typescript::Constraint),
        ("type_parameter", Typescript::TypeParameter),
        ("flow_maybe_type", Typescript::FlowMaybeType),
        ("...", Typescript::DOTDOTDOT),
        ("<<", Typescript::LTLT),
        ("continue", Typescript::Continue),
        ("boolean", Typescript::Boolean),
        ("non_null_expression", Typescript::NonNullExpression),
        ("_expression", Typescript::Expression),
        ("symbol", Typescript::Symbol),
        ("regex", Typescript::Regex),
        (
            "_import_export_specifier",
            Typescript::ImportExportSpecifier,
        ),
        ("for_statement", Typescript::ForStatement),
        ("arrow_function", Typescript::ArrowFunction),
        ("nested_identifier", Typescript::NestedIdentifier),
        (
            "export_statement_repeat1",
            Typescript::ExportStatementRepeat1,
        ),
        ("import_require_clause", Typescript::ImportRequireClause),
        ("case", Typescript::Case),
        ("regex_pattern", Typescript::RegexPattern),
        (",", Typescript::COMMA),
        ("_declaration", Typescript::Declaration),
        ("switch", Typescript::Switch),
        ("&=", Typescript::AMPEQ),
        ("new", Typescript::New),
        ("&&", Typescript::AMPAMP),
        ("type_parameters", Typescript::TypeParameters),
        ("<<=", Typescript::LTLTEQ),
        ("_template_chars", Typescript::TemplateChars),
        ("_initializer", Typescript::Initializer),
        ("_for_header", Typescript::ForHeader),
        ("`", Typescript::BQUOTE),
        (">>=", Typescript::GTGTEQ),
        ("function_type", Typescript::FunctionType),
        ("finally", Typescript::Finally),
        ("string_token1", Typescript::StringToken1),
        ("while", Typescript::While),
        (".", Typescript::DOT),
        ("delete", Typescript::Delete),
        ("keyof", Typescript::Keyof),
        ("interface", Typescript::Interface),
        ("extends_clause", Typescript::ExtendsClause),
        ("member_expression", Typescript::MemberExpression),
        ("??", Typescript::QMARKQMARK),
        ("type_alias_declaration", Typescript::TypeAliasDeclaration),
        ("object", Typescript::Object),
        ("await", Typescript::Await),
        ("program_repeat1", Typescript::ProgramRepeat1),
        ("enum", Typescript::Enum),
        ("expression_statement", Typescript::ExpressionStatement),
        (">>", Typescript::GTGT),
        ("try", Typescript::Try),
        ("/=", Typescript::SLASHEQ),
        ("typeof", Typescript::Typeof),
        ("union_type", Typescript::UnionType),
        ("literal_type", Typescript::LiteralType),
        ("private", Typescript::Private),
        ("object_pattern", Typescript::ObjectPattern),
        ("ambient_declaration", Typescript::AmbientDeclaration),
        ("internal_module", Typescript::InternalModule),
        ("?", Typescript::QMARK),
        ("for_in_statement", Typescript::ForInStatement),
        ("const", Typescript::Const),
        ("global", Typescript::Global),
        ("_property_name", Typescript::PropertyName),
        ("namespace_import", Typescript::NamespaceImport),
        ("type_parameters_repeat1", Typescript::TypeParametersRepeat1),
        ("=", Typescript::EQ),
        ("object_repeat1", Typescript::ObjectRepeat1),
        ("throw", Typescript::Throw),
        ("debugger", Typescript::Debugger),
        ("|}", Typescript::PIPERBRACE),
        ("class_heritage", Typescript::ClassHeritage),
        ("comment", Typescript::Comment),
        ("implements", Typescript::Implements),
        ("index_signature", Typescript::IndexSignature),
        ("undefined", Typescript::Undefined),
        ("import_statement", Typescript::ImportStatement),
        ("extends_clause_repeat1", Typescript::ExtendsClauseRepeat1),
        (":", Typescript::COLON),
        ("parenthesized_type", Typescript::ParenthesizedType),
        ("spread_element", Typescript::SpreadElement),
        ("_primary_type", Typescript::PrimaryType),
        ("string_repeat2", Typescript::StringRepeat2),
        ("sequence_expression", Typescript::SequenceExpression),
        ("assignment_expression", Typescript::AssignmentExpression),
        ("/", Typescript::SLASH),
        ("module", Typescript::Module),
        ("finally_clause", Typescript::FinallyClause),
        ("static", Typescript::Static),
        ("string_token2", Typescript::StringToken2),
        ("protected", Typescript::Protected),
        ("\'", Typescript::SQUOTE),
        (">", Typescript::GT),
        ("enum_body_repeat1", Typescript::EnumBodyRepeat1),
        ("switch_default", Typescript::SwitchDefault),
        ("_parameter_name", Typescript::ParameterName),
        ("class_declaration", Typescript::ClassDeclaration),
        ("required_parameter", Typescript::RequiredParameter),
        (
            "abstract_class_declaration",
            Typescript::AbstractClassDeclaration,
        ),
        ("continue_statement", Typescript::ContinueStatement),
        ("%=", Typescript::PERCENTEQ),
        ("template_string_repeat1", Typescript::TemplateStringRepeat1),
        ("interface_declaration", Typescript::InterfaceDeclaration),
        ("true", Typescript::True),
        ("named_imports_repeat1", Typescript::NamedImportsRepeat1),
        ("labeled_statement", Typescript::LabeledStatement),
        (
            "variable_declaration_repeat1",
            Typescript::VariableDeclarationRepeat1,
        ),
        (")", Typescript::RPAREN),
        ("class", Typescript::Class),
        ("public_field_definition", Typescript::PublicFieldDefinition),
        ("export", Typescript::Export),
        ("subscript_expression", Typescript::SubscriptExpression),
        ("lexical_declaration", Typescript::LexicalDeclaration),
        ("arguments", Typescript::Arguments),
        ("^", Typescript::CARET),
        ("--", Typescript::DASHDASH),
        ("debugger_statement", Typescript::DebuggerStatement),
        ("method_signature", Typescript::MethodSignature),
        ("switch_body_repeat1", Typescript::SwitchBodyRepeat1),
        ("object_type_repeat1", Typescript::ObjectTypeRepeat1),
        ("!==", Typescript::BANGEQEQ),
        ("variable_declaration", Typescript::VariableDeclaration),
        ("*", Typescript::STAR),
        ("property_signature", Typescript::PropertySignature),
        ("mapped_type_clause", Typescript::MappedTypeClause),
        ("property_identifier", Typescript::PropertyIdentifier),
        ("constructor_type", Typescript::ConstructorType),
        ("binary_expression", Typescript::BinaryExpression),
        ("empty_statement", Typescript::EmptyStatement),
        (";", Typescript::SEMI),
        ("import_alias", Typescript::ImportAlias),
        ("named_imports", Typescript::NamedImports),
        ("call_expression", Typescript::CallExpression),
        ("do", Typescript::Do),
        ("switch_statement", Typescript::SwitchStatement),
        ("this", Typescript::This),
        ("_call_signature", Typescript::CallSignature),
        ("set", Typescript::Set),
        ("with", Typescript::With),
        ("===", Typescript::EQEQEQ),
        ("for", Typescript::For),
        ("let", Typescript::Let),
        (
            "augmented_assignment_expression",
            Typescript::AugmentedAssignmentExpression,
        ),
        ("throw_statement", Typescript::ThrowStatement),
        ("default_type", Typescript::DefaultType),
        ("string_repeat1", Typescript::StringRepeat1),
        ("type_annotation", Typescript::TypeAnnotation),
        ("statement_identifier", Typescript::StatementIdentifier),
        ("variable_declarator", Typescript::VariableDeclarator),
        ("~", Typescript::TILDE),
        ("**=", Typescript::STARSTAREQ),
        ("readonly", Typescript::Readonly),
        ("namespace", Typescript::Namespace),
        ("]", Typescript::RBRACK),
        ("**", Typescript::STARSTAR),
        ("async", Typescript::Async),
        ("function_declaration", Typescript::FunctionDeclaration),
        ("while_statement", Typescript::WhileStatement),
        ("decorator", Typescript::Decorator),
        ("generic_type", Typescript::GenericType),
        ("template_substitution", Typescript::TemplateSubstitution),
        ("instanceof", Typescript::Instanceof),
        ("regex_flags", Typescript::RegexFlags),
        ("update_expression", Typescript::UpdateExpression),
        ("++", Typescript::PLUSPLUS),
        ("+=", Typescript::PLUSEQ),
        (">>>", Typescript::GTGTGT),
        ("do_statement", Typescript::DoStatement),
        ("<=", Typescript::LTEQ),
        ("extends", Typescript::Extends),
        ("program", Typescript::Program),
        ("ERROR", Typescript::Error),
        ("==", Typescript::EQEQ),
        ("import_specifier", Typescript::ImportSpecifier),
    ]),
};

impl From<&str> for Typescript {
    #[inline(always)]
    fn from(key: &str) -> Self {
        KEYS.get(key).unwrap().clone()
    }
}

impl From<u16> for Typescript {
    #[inline(always)]
    fn from(x: u16) -> Self {
        unsafe { std::mem::transmute(x) }
    }
}

// Typescript == u16
impl PartialEq<u16> for Typescript {
    #[inline(always)]
    fn eq(&self, x: &u16) -> bool {
        *self == Typescript::from(*x)
    }
}

// u16 == Typescript
impl PartialEq<Typescript> for u16 {
    #[inline(always)]
    fn eq(&self, x: &Typescript) -> bool {
        *x == *self
    }
}