Skip to main content

big_code_analysis_ast/languages/
language_c.rs

1// See `src/languages/mod.rs` for the rationale behind the per-file
2// pedantic carve-outs below.
3#![allow(clippy::match_same_arms, clippy::too_many_lines)]
4// One variant per grammar kind id, named after the rule; the name is
5// the documentation and there is nothing per-variant to add.
6#![allow(missing_docs)]
7
8// Code generated; DO NOT EDIT.
9
10use num_derive::FromPrimitive;
11
12#[derive(Clone, Debug, PartialEq, Eq, FromPrimitive)]
13pub enum C {
14    End = 0,
15    Identifier = 1,
16    HASHinclude = 2,
17    PreprocIncludeToken2 = 3,
18    HASHdefine = 4,
19    LPAREN = 5,
20    DOTDOTDOT = 6,
21    COMMA = 7,
22    RPAREN = 8,
23    HASHif = 9,
24    LF = 10,
25    HASHendif = 11,
26    HASHifdef = 12,
27    HASHifndef = 13,
28    HASHelse = 14,
29    HASHelif = 15,
30    HASHelifdef = 16,
31    HASHelifndef = 17,
32    PreprocArg = 18,
33    PreprocDirective = 19,
34    LPAREN2 = 20,
35    Defined = 21,
36    BANG = 22,
37    TILDE = 23,
38    DASH = 24,
39    PLUS = 25,
40    STAR = 26,
41    SLASH = 27,
42    PERCENT = 28,
43    PIPEPIPE = 29,
44    AMPAMP = 30,
45    PIPE = 31,
46    CARET = 32,
47    AMP = 33,
48    EQEQ = 34,
49    BANGEQ = 35,
50    GT = 36,
51    GTEQ = 37,
52    LTEQ = 38,
53    LT = 39,
54    LTLT = 40,
55    GTGT = 41,
56    SEMI = 42,
57    Extension = 43,
58    Typedef = 44,
59    Extern = 45,
60    Attribute2 = 46,
61    Attribute3 = 47,
62    COLONCOLON = 48,
63    LBRACKLBRACK = 49,
64    RBRACKRBRACK = 50,
65    Declspec = 51,
66    Based = 52,
67    Cdecl = 53,
68    Clrcall = 54,
69    Stdcall = 55,
70    Fastcall = 56,
71    Thiscall = 57,
72    Vectorcall = 58,
73    MsRestrictModifier = 59,
74    MsUnsignedPtrModifier = 60,
75    MsSignedPtrModifier = 61,
76    Unaligned = 62,
77    Unaligned2 = 63,
78    LBRACE = 64,
79    RBRACE = 65,
80    Signed = 66,
81    Unsigned = 67,
82    Long = 68,
83    Short = 69,
84    LBRACK = 70,
85    Static = 71,
86    RBRACK = 72,
87    EQ = 73,
88    Auto = 74,
89    Register = 75,
90    Inline = 76,
91    Inline2 = 77,
92    Inline3 = 78,
93    Forceinline = 79,
94    ThreadLocal = 80,
95    Thread = 81,
96    Const = 82,
97    Constexpr = 83,
98    Volatile = 84,
99    Restrict = 85,
100    Restrict2 = 86,
101    Atomic = 87,
102    Noreturn = 88,
103    Noreturn2 = 89,
104    Nonnull = 90,
105    Alignas = 91,
106    Alignas2 = 92,
107    PrimitiveType = 93,
108    Enum = 94,
109    COLON = 95,
110    Struct = 96,
111    Union = 97,
112    If = 98,
113    Else = 99,
114    Switch = 100,
115    Case = 101,
116    Default = 102,
117    While = 103,
118    Do = 104,
119    For = 105,
120    Return = 106,
121    Break = 107,
122    Continue = 108,
123    Goto = 109,
124    Try = 110,
125    Except = 111,
126    Finally = 112,
127    Leave = 113,
128    QMARK = 114,
129    STAREQ = 115,
130    SLASHEQ = 116,
131    PERCENTEQ = 117,
132    PLUSEQ = 118,
133    DASHEQ = 119,
134    LTLTEQ = 120,
135    GTGTEQ = 121,
136    AMPEQ = 122,
137    CARETEQ = 123,
138    PIPEEQ = 124,
139    DASHDASH = 125,
140    PLUSPLUS = 126,
141    Sizeof = 127,
142    Alignof = 128,
143    Alignof2 = 129,
144    Alignof3 = 130,
145    Alignof4 = 131,
146    Alignof5 = 132,
147    Offsetof = 133,
148    Generic = 134,
149    Asm = 135,
150    Asm2 = 136,
151    Asm3 = 137,
152    Volatile2 = 138,
153    DOT = 139,
154    DASHGT = 140,
155    NumberLiteral = 141,
156    LSQUOTE = 142,
157    USQUOTE = 143,
158    USQUOTE2 = 144,
159    U8SQUOTE = 145,
160    SQUOTE = 146,
161    Character = 147,
162    LDQUOTE = 148,
163    UDQUOTE = 149,
164    UDQUOTE2 = 150,
165    U8DQUOTE = 151,
166    DQUOTE = 152,
167    StringContent = 153,
168    EscapeSequence = 154,
169    SystemLibString = 155,
170    True = 156,
171    False = 157,
172    NULL = 158,
173    Nullptr = 159,
174    Comment = 160,
175    TranslationUnit = 161,
176    TopLevelItem = 162,
177    BlockItem = 163,
178    PreprocInclude = 164,
179    PreprocDef = 165,
180    PreprocFunctionDef = 166,
181    PreprocParams = 167,
182    PreprocCall = 168,
183    PreprocIf = 169,
184    PreprocIfdef = 170,
185    PreprocElse = 171,
186    PreprocElif = 172,
187    PreprocElifdef = 173,
188    PreprocIf2 = 174,
189    PreprocIfdef2 = 175,
190    PreprocElse2 = 176,
191    PreprocElif2 = 177,
192    PreprocElifdef2 = 178,
193    PreprocIf3 = 179,
194    PreprocIfdef3 = 180,
195    PreprocElse3 = 181,
196    PreprocElif3 = 182,
197    PreprocElifdef3 = 183,
198    PreprocIf4 = 184,
199    PreprocIfdef4 = 185,
200    PreprocElse4 = 186,
201    PreprocElif4 = 187,
202    PreprocElifdef4 = 188,
203    PreprocExpression = 189,
204    ParenthesizedExpression = 190,
205    PreprocDefined = 191,
206    UnaryExpression = 192,
207    CallExpression = 193,
208    ArgumentList = 194,
209    BinaryExpression = 195,
210    FunctionDefinition = 196,
211    FunctionDefinition2 = 197,
212    Declaration = 198,
213    TypeDefinition = 199,
214    TypeDefinitionType = 200,
215    TypeDefinitionDeclarators = 201,
216    DeclarationModifiers = 202,
217    DeclarationSpecifiers = 203,
218    LinkageSpecification = 204,
219    AttributeSpecifier = 205,
220    Attribute = 206,
221    AttributeDeclaration = 207,
222    MsDeclspecModifier = 208,
223    MsBasedModifier = 209,
224    MsCallModifier = 210,
225    MsUnalignedPtrModifier = 211,
226    MsPointerModifier = 212,
227    DeclarationList = 213,
228    Declarator = 214,
229    DeclarationDeclarator = 215,
230    FieldDeclarator = 216,
231    TypeDeclarator = 217,
232    AbstractDeclarator = 218,
233    ParenthesizedDeclarator = 219,
234    ParenthesizedDeclarator2 = 220,
235    ParenthesizedDeclarator3 = 221,
236    AbstractParenthesizedDeclarator = 222,
237    AttributedDeclarator = 223,
238    AttributedDeclarator2 = 224,
239    AttributedDeclarator3 = 225,
240    PointerDeclarator = 226,
241    PointerDeclarator2 = 227,
242    PointerDeclarator3 = 228,
243    AbstractPointerDeclarator = 229,
244    FunctionDeclarator = 230,
245    FunctionDeclarator2 = 231,
246    FunctionDeclarator3 = 232,
247    FunctionDeclarator4 = 233,
248    AbstractFunctionDeclarator = 234,
249    FunctionDeclarator5 = 235,
250    ArrayDeclarator = 236,
251    ArrayDeclarator2 = 237,
252    ArrayDeclarator3 = 238,
253    AbstractArrayDeclarator = 239,
254    InitDeclarator = 240,
255    CompoundStatement = 241,
256    StorageClassSpecifier = 242,
257    TypeQualifier = 243,
258    AlignasQualifier = 244,
259    TypeSpecifier = 245,
260    SizedTypeSpecifier = 246,
261    EnumSpecifier = 247,
262    EnumeratorList = 248,
263    StructSpecifier = 249,
264    UnionSpecifier = 250,
265    FieldDeclarationList = 251,
266    FieldDeclarationListItem = 252,
267    FieldDeclaration = 253,
268    FieldDeclarationDeclarator = 254,
269    BitfieldClause = 255,
270    Enumerator = 256,
271    VariadicParameter = 257,
272    ParameterList = 258,
273    ParameterList2 = 259,
274    ParameterDeclaration = 260,
275    AttributedStatement = 261,
276    Statement = 262,
277    TopLevelStatement = 263,
278    LabeledStatement = 264,
279    ExpressionStatement = 265,
280    ExpressionStatement2 = 266,
281    IfStatement = 267,
282    ElseClause = 268,
283    SwitchStatement = 269,
284    CaseStatement = 270,
285    WhileStatement = 271,
286    DoStatement = 272,
287    ForStatement = 273,
288    ForStatementBody = 274,
289    ReturnStatement = 275,
290    BreakStatement = 276,
291    ContinueStatement = 277,
292    GotoStatement = 278,
293    SehTryStatement = 279,
294    SehExceptClause = 280,
295    SehFinallyClause = 281,
296    SehLeaveStatement = 282,
297    Expression = 283,
298    String = 284,
299    CommaExpression = 285,
300    ConditionalExpression = 286,
301    AssignmentExpression = 287,
302    PointerExpression = 288,
303    UnaryExpression2 = 289,
304    BinaryExpression2 = 290,
305    UpdateExpression = 291,
306    CastExpression = 292,
307    TypeDescriptor = 293,
308    SizeofExpression = 294,
309    AlignofExpression = 295,
310    OffsetofExpression = 296,
311    GenericExpression = 297,
312    SubscriptExpression = 298,
313    CallExpression2 = 299,
314    GnuAsmExpression = 300,
315    GnuAsmQualifier = 301,
316    GnuAsmOutputOperandList = 302,
317    GnuAsmOutputOperand = 303,
318    GnuAsmInputOperandList = 304,
319    GnuAsmInputOperand = 305,
320    GnuAsmClobberList = 306,
321    GnuAsmGotoList = 307,
322    ExtensionExpression = 308,
323    ArgumentList2 = 309,
324    FieldExpression = 310,
325    CompoundLiteralExpression = 311,
326    ParenthesizedExpression2 = 312,
327    InitializerList = 313,
328    InitializerPair = 314,
329    SubscriptDesignator = 315,
330    SubscriptRangeDesignator = 316,
331    FieldDesignator = 317,
332    CharLiteral = 318,
333    ConcatenatedString = 319,
334    StringLiteral = 320,
335    Null = 321,
336    EmptyDeclaration = 322,
337    MacroTypeSpecifier = 323,
338    TranslationUnitRepeat1 = 324,
339    PreprocParamsRepeat1 = 325,
340    PreprocIfRepeat1 = 326,
341    PreprocIfInFieldDeclarationListRepeat1 = 327,
342    PreprocIfInEnumeratorListRepeat1 = 328,
343    PreprocIfInEnumeratorListNoCommaRepeat1 = 329,
344    PreprocArgumentListRepeat1 = 330,
345    OldStyleFunctionDefinitionRepeat1 = 331,
346    DeclarationRepeat1 = 332,
347    TypeDefinitionRepeat1 = 333,
348    TypeDefinitionTypeRepeat1 = 334,
349    TypeDefinitionDeclaratorsRepeat1 = 335,
350    DeclarationSpecifiersRepeat1 = 336,
351    AttributeDeclarationRepeat1 = 337,
352    AttributedDeclaratorRepeat1 = 338,
353    PointerDeclaratorRepeat1 = 339,
354    FunctionDeclaratorRepeat1 = 340,
355    ArrayDeclaratorRepeat1 = 341,
356    SizedTypeSpecifierRepeat1 = 342,
357    EnumeratorListRepeat1 = 343,
358    FieldDeclarationDeclaratorRepeat1 = 344,
359    ParameterListRepeat1 = 345,
360    OldStyleParameterListRepeat1 = 346,
361    CaseStatementRepeat1 = 347,
362    GenericExpressionRepeat1 = 348,
363    GnuAsmExpressionRepeat1 = 349,
364    GnuAsmOutputOperandListRepeat1 = 350,
365    GnuAsmInputOperandListRepeat1 = 351,
366    GnuAsmClobberListRepeat1 = 352,
367    GnuAsmGotoListRepeat1 = 353,
368    ArgumentListRepeat1 = 354,
369    InitializerListRepeat1 = 355,
370    InitializerPairRepeat1 = 356,
371    CharLiteralRepeat1 = 357,
372    ConcatenatedStringRepeat1 = 358,
373    StringLiteralRepeat1 = 359,
374    FieldIdentifier = 360,
375    StatementIdentifier = 361,
376    TypeIdentifier = 362,
377    Error = 363,
378}
379
380impl From<C> for &'static str {
381    #[inline]
382    fn from(tok: C) -> Self {
383        match tok {
384            C::End => "end",
385            C::Identifier => "identifier",
386            C::HASHinclude => "#include",
387            C::PreprocIncludeToken2 => "preproc_include_token2",
388            C::HASHdefine => "#define",
389            C::LPAREN => "(",
390            C::DOTDOTDOT => "...",
391            C::COMMA => ",",
392            C::RPAREN => ")",
393            C::HASHif => "#if",
394            C::LF => "\n",
395            C::HASHendif => "#endif",
396            C::HASHifdef => "#ifdef",
397            C::HASHifndef => "#ifndef",
398            C::HASHelse => "#else",
399            C::HASHelif => "#elif",
400            C::HASHelifdef => "#elifdef",
401            C::HASHelifndef => "#elifndef",
402            C::PreprocArg => "preproc_arg",
403            C::PreprocDirective => "preproc_directive",
404            C::LPAREN2 => "(",
405            C::Defined => "defined",
406            C::BANG => "!",
407            C::TILDE => "~",
408            C::DASH => "-",
409            C::PLUS => "+",
410            C::STAR => "*",
411            C::SLASH => "/",
412            C::PERCENT => "%",
413            C::PIPEPIPE => "||",
414            C::AMPAMP => "&&",
415            C::PIPE => "|",
416            C::CARET => "^",
417            C::AMP => "&",
418            C::EQEQ => "==",
419            C::BANGEQ => "!=",
420            C::GT => ">",
421            C::GTEQ => ">=",
422            C::LTEQ => "<=",
423            C::LT => "<",
424            C::LTLT => "<<",
425            C::GTGT => ">>",
426            C::SEMI => ";",
427            C::Extension => "__extension__",
428            C::Typedef => "typedef",
429            C::Extern => "extern",
430            C::Attribute2 => "__attribute__",
431            C::Attribute3 => "__attribute",
432            C::COLONCOLON => "::",
433            C::LBRACKLBRACK => "[[",
434            C::RBRACKRBRACK => "]]",
435            C::Declspec => "__declspec",
436            C::Based => "__based",
437            C::Cdecl => "__cdecl",
438            C::Clrcall => "__clrcall",
439            C::Stdcall => "__stdcall",
440            C::Fastcall => "__fastcall",
441            C::Thiscall => "__thiscall",
442            C::Vectorcall => "__vectorcall",
443            C::MsRestrictModifier => "ms_restrict_modifier",
444            C::MsUnsignedPtrModifier => "ms_unsigned_ptr_modifier",
445            C::MsSignedPtrModifier => "ms_signed_ptr_modifier",
446            C::Unaligned => "_unaligned",
447            C::Unaligned2 => "__unaligned",
448            C::LBRACE => "{",
449            C::RBRACE => "}",
450            C::Signed => "signed",
451            C::Unsigned => "unsigned",
452            C::Long => "long",
453            C::Short => "short",
454            C::LBRACK => "[",
455            C::Static => "static",
456            C::RBRACK => "]",
457            C::EQ => "=",
458            C::Auto => "auto",
459            C::Register => "register",
460            C::Inline => "inline",
461            C::Inline2 => "__inline",
462            C::Inline3 => "__inline__",
463            C::Forceinline => "__forceinline",
464            C::ThreadLocal => "thread_local",
465            C::Thread => "__thread",
466            C::Const => "const",
467            C::Constexpr => "constexpr",
468            C::Volatile => "volatile",
469            C::Restrict => "restrict",
470            C::Restrict2 => "__restrict__",
471            C::Atomic => "_Atomic",
472            C::Noreturn => "_Noreturn",
473            C::Noreturn2 => "noreturn",
474            C::Nonnull => "_Nonnull",
475            C::Alignas => "alignas",
476            C::Alignas2 => "_Alignas",
477            C::PrimitiveType => "primitive_type",
478            C::Enum => "enum",
479            C::COLON => ":",
480            C::Struct => "struct",
481            C::Union => "union",
482            C::If => "if",
483            C::Else => "else",
484            C::Switch => "switch",
485            C::Case => "case",
486            C::Default => "default",
487            C::While => "while",
488            C::Do => "do",
489            C::For => "for",
490            C::Return => "return",
491            C::Break => "break",
492            C::Continue => "continue",
493            C::Goto => "goto",
494            C::Try => "__try",
495            C::Except => "__except",
496            C::Finally => "__finally",
497            C::Leave => "__leave",
498            C::QMARK => "?",
499            C::STAREQ => "*=",
500            C::SLASHEQ => "/=",
501            C::PERCENTEQ => "%=",
502            C::PLUSEQ => "+=",
503            C::DASHEQ => "-=",
504            C::LTLTEQ => "<<=",
505            C::GTGTEQ => ">>=",
506            C::AMPEQ => "&=",
507            C::CARETEQ => "^=",
508            C::PIPEEQ => "|=",
509            C::DASHDASH => "--",
510            C::PLUSPLUS => "++",
511            C::Sizeof => "sizeof",
512            C::Alignof => "__alignof__",
513            C::Alignof2 => "__alignof",
514            C::Alignof3 => "_alignof",
515            C::Alignof4 => "alignof",
516            C::Alignof5 => "_Alignof",
517            C::Offsetof => "offsetof",
518            C::Generic => "_Generic",
519            C::Asm => "asm",
520            C::Asm2 => "__asm__",
521            C::Asm3 => "__asm",
522            C::Volatile2 => "__volatile__",
523            C::DOT => ".",
524            C::DASHGT => "->",
525            C::NumberLiteral => "number_literal",
526            C::LSQUOTE => "L'",
527            C::USQUOTE => "u'",
528            C::USQUOTE2 => "U'",
529            C::U8SQUOTE => "u8'",
530            C::SQUOTE => "'",
531            C::Character => "character",
532            C::LDQUOTE => "L\"",
533            C::UDQUOTE => "u\"",
534            C::UDQUOTE2 => "U\"",
535            C::U8DQUOTE => "u8\"",
536            C::DQUOTE => "\"",
537            C::StringContent => "string_content",
538            C::EscapeSequence => "escape_sequence",
539            C::SystemLibString => "system_lib_string",
540            C::True => "true",
541            C::False => "false",
542            C::NULL => "NULL",
543            C::Nullptr => "nullptr",
544            C::Comment => "comment",
545            C::TranslationUnit => "translation_unit",
546            C::TopLevelItem => "_top_level_item",
547            C::BlockItem => "_block_item",
548            C::PreprocInclude => "preproc_include",
549            C::PreprocDef => "preproc_def",
550            C::PreprocFunctionDef => "preproc_function_def",
551            C::PreprocParams => "preproc_params",
552            C::PreprocCall => "preproc_call",
553            C::PreprocIf => "preproc_if",
554            C::PreprocIfdef => "preproc_ifdef",
555            C::PreprocElse => "preproc_else",
556            C::PreprocElif => "preproc_elif",
557            C::PreprocElifdef => "preproc_elifdef",
558            C::PreprocIf2 => "preproc_if",
559            C::PreprocIfdef2 => "preproc_ifdef",
560            C::PreprocElse2 => "preproc_else",
561            C::PreprocElif2 => "preproc_elif",
562            C::PreprocElifdef2 => "preproc_elifdef",
563            C::PreprocIf3 => "preproc_if",
564            C::PreprocIfdef3 => "preproc_ifdef",
565            C::PreprocElse3 => "preproc_else",
566            C::PreprocElif3 => "preproc_elif",
567            C::PreprocElifdef3 => "preproc_elifdef",
568            C::PreprocIf4 => "preproc_if",
569            C::PreprocIfdef4 => "preproc_ifdef",
570            C::PreprocElse4 => "preproc_else",
571            C::PreprocElif4 => "preproc_elif",
572            C::PreprocElifdef4 => "preproc_elifdef",
573            C::PreprocExpression => "_preproc_expression",
574            C::ParenthesizedExpression => "parenthesized_expression",
575            C::PreprocDefined => "preproc_defined",
576            C::UnaryExpression => "unary_expression",
577            C::CallExpression => "call_expression",
578            C::ArgumentList => "argument_list",
579            C::BinaryExpression => "binary_expression",
580            C::FunctionDefinition => "function_definition",
581            C::FunctionDefinition2 => "function_definition",
582            C::Declaration => "declaration",
583            C::TypeDefinition => "type_definition",
584            C::TypeDefinitionType => "_type_definition_type",
585            C::TypeDefinitionDeclarators => "_type_definition_declarators",
586            C::DeclarationModifiers => "_declaration_modifiers",
587            C::DeclarationSpecifiers => "_declaration_specifiers",
588            C::LinkageSpecification => "linkage_specification",
589            C::AttributeSpecifier => "attribute_specifier",
590            C::Attribute => "attribute",
591            C::AttributeDeclaration => "attribute_declaration",
592            C::MsDeclspecModifier => "ms_declspec_modifier",
593            C::MsBasedModifier => "ms_based_modifier",
594            C::MsCallModifier => "ms_call_modifier",
595            C::MsUnalignedPtrModifier => "ms_unaligned_ptr_modifier",
596            C::MsPointerModifier => "ms_pointer_modifier",
597            C::DeclarationList => "declaration_list",
598            C::Declarator => "_declarator",
599            C::DeclarationDeclarator => "_declaration_declarator",
600            C::FieldDeclarator => "_field_declarator",
601            C::TypeDeclarator => "_type_declarator",
602            C::AbstractDeclarator => "_abstract_declarator",
603            C::ParenthesizedDeclarator => "parenthesized_declarator",
604            C::ParenthesizedDeclarator2 => "parenthesized_declarator",
605            C::ParenthesizedDeclarator3 => "parenthesized_declarator",
606            C::AbstractParenthesizedDeclarator => "abstract_parenthesized_declarator",
607            C::AttributedDeclarator => "attributed_declarator",
608            C::AttributedDeclarator2 => "attributed_declarator",
609            C::AttributedDeclarator3 => "attributed_declarator",
610            C::PointerDeclarator => "pointer_declarator",
611            C::PointerDeclarator2 => "pointer_declarator",
612            C::PointerDeclarator3 => "pointer_declarator",
613            C::AbstractPointerDeclarator => "abstract_pointer_declarator",
614            C::FunctionDeclarator => "function_declarator",
615            C::FunctionDeclarator2 => "function_declarator",
616            C::FunctionDeclarator3 => "function_declarator",
617            C::FunctionDeclarator4 => "function_declarator",
618            C::AbstractFunctionDeclarator => "abstract_function_declarator",
619            C::FunctionDeclarator5 => "function_declarator",
620            C::ArrayDeclarator => "array_declarator",
621            C::ArrayDeclarator2 => "array_declarator",
622            C::ArrayDeclarator3 => "array_declarator",
623            C::AbstractArrayDeclarator => "abstract_array_declarator",
624            C::InitDeclarator => "init_declarator",
625            C::CompoundStatement => "compound_statement",
626            C::StorageClassSpecifier => "storage_class_specifier",
627            C::TypeQualifier => "type_qualifier",
628            C::AlignasQualifier => "alignas_qualifier",
629            C::TypeSpecifier => "type_specifier",
630            C::SizedTypeSpecifier => "sized_type_specifier",
631            C::EnumSpecifier => "enum_specifier",
632            C::EnumeratorList => "enumerator_list",
633            C::StructSpecifier => "struct_specifier",
634            C::UnionSpecifier => "union_specifier",
635            C::FieldDeclarationList => "field_declaration_list",
636            C::FieldDeclarationListItem => "_field_declaration_list_item",
637            C::FieldDeclaration => "field_declaration",
638            C::FieldDeclarationDeclarator => "_field_declaration_declarator",
639            C::BitfieldClause => "bitfield_clause",
640            C::Enumerator => "enumerator",
641            C::VariadicParameter => "variadic_parameter",
642            C::ParameterList => "parameter_list",
643            C::ParameterList2 => "parameter_list",
644            C::ParameterDeclaration => "parameter_declaration",
645            C::AttributedStatement => "attributed_statement",
646            C::Statement => "statement",
647            C::TopLevelStatement => "_top_level_statement",
648            C::LabeledStatement => "labeled_statement",
649            C::ExpressionStatement => "expression_statement",
650            C::ExpressionStatement2 => "expression_statement",
651            C::IfStatement => "if_statement",
652            C::ElseClause => "else_clause",
653            C::SwitchStatement => "switch_statement",
654            C::CaseStatement => "case_statement",
655            C::WhileStatement => "while_statement",
656            C::DoStatement => "do_statement",
657            C::ForStatement => "for_statement",
658            C::ForStatementBody => "_for_statement_body",
659            C::ReturnStatement => "return_statement",
660            C::BreakStatement => "break_statement",
661            C::ContinueStatement => "continue_statement",
662            C::GotoStatement => "goto_statement",
663            C::SehTryStatement => "seh_try_statement",
664            C::SehExceptClause => "seh_except_clause",
665            C::SehFinallyClause => "seh_finally_clause",
666            C::SehLeaveStatement => "seh_leave_statement",
667            C::Expression => "expression",
668            C::String => "_string",
669            C::CommaExpression => "comma_expression",
670            C::ConditionalExpression => "conditional_expression",
671            C::AssignmentExpression => "assignment_expression",
672            C::PointerExpression => "pointer_expression",
673            C::UnaryExpression2 => "unary_expression",
674            C::BinaryExpression2 => "binary_expression",
675            C::UpdateExpression => "update_expression",
676            C::CastExpression => "cast_expression",
677            C::TypeDescriptor => "type_descriptor",
678            C::SizeofExpression => "sizeof_expression",
679            C::AlignofExpression => "alignof_expression",
680            C::OffsetofExpression => "offsetof_expression",
681            C::GenericExpression => "generic_expression",
682            C::SubscriptExpression => "subscript_expression",
683            C::CallExpression2 => "call_expression",
684            C::GnuAsmExpression => "gnu_asm_expression",
685            C::GnuAsmQualifier => "gnu_asm_qualifier",
686            C::GnuAsmOutputOperandList => "gnu_asm_output_operand_list",
687            C::GnuAsmOutputOperand => "gnu_asm_output_operand",
688            C::GnuAsmInputOperandList => "gnu_asm_input_operand_list",
689            C::GnuAsmInputOperand => "gnu_asm_input_operand",
690            C::GnuAsmClobberList => "gnu_asm_clobber_list",
691            C::GnuAsmGotoList => "gnu_asm_goto_list",
692            C::ExtensionExpression => "extension_expression",
693            C::ArgumentList2 => "argument_list",
694            C::FieldExpression => "field_expression",
695            C::CompoundLiteralExpression => "compound_literal_expression",
696            C::ParenthesizedExpression2 => "parenthesized_expression",
697            C::InitializerList => "initializer_list",
698            C::InitializerPair => "initializer_pair",
699            C::SubscriptDesignator => "subscript_designator",
700            C::SubscriptRangeDesignator => "subscript_range_designator",
701            C::FieldDesignator => "field_designator",
702            C::CharLiteral => "char_literal",
703            C::ConcatenatedString => "concatenated_string",
704            C::StringLiteral => "string_literal",
705            C::Null => "null",
706            C::EmptyDeclaration => "_empty_declaration",
707            C::MacroTypeSpecifier => "macro_type_specifier",
708            C::TranslationUnitRepeat1 => "translation_unit_repeat1",
709            C::PreprocParamsRepeat1 => "preproc_params_repeat1",
710            C::PreprocIfRepeat1 => "preproc_if_repeat1",
711            C::PreprocIfInFieldDeclarationListRepeat1 => {
712                "preproc_if_in_field_declaration_list_repeat1"
713            }
714            C::PreprocIfInEnumeratorListRepeat1 => "preproc_if_in_enumerator_list_repeat1",
715            C::PreprocIfInEnumeratorListNoCommaRepeat1 => {
716                "preproc_if_in_enumerator_list_no_comma_repeat1"
717            }
718            C::PreprocArgumentListRepeat1 => "preproc_argument_list_repeat1",
719            C::OldStyleFunctionDefinitionRepeat1 => "_old_style_function_definition_repeat1",
720            C::DeclarationRepeat1 => "declaration_repeat1",
721            C::TypeDefinitionRepeat1 => "type_definition_repeat1",
722            C::TypeDefinitionTypeRepeat1 => "_type_definition_type_repeat1",
723            C::TypeDefinitionDeclaratorsRepeat1 => "_type_definition_declarators_repeat1",
724            C::DeclarationSpecifiersRepeat1 => "_declaration_specifiers_repeat1",
725            C::AttributeDeclarationRepeat1 => "attribute_declaration_repeat1",
726            C::AttributedDeclaratorRepeat1 => "attributed_declarator_repeat1",
727            C::PointerDeclaratorRepeat1 => "pointer_declarator_repeat1",
728            C::FunctionDeclaratorRepeat1 => "function_declarator_repeat1",
729            C::ArrayDeclaratorRepeat1 => "array_declarator_repeat1",
730            C::SizedTypeSpecifierRepeat1 => "sized_type_specifier_repeat1",
731            C::EnumeratorListRepeat1 => "enumerator_list_repeat1",
732            C::FieldDeclarationDeclaratorRepeat1 => "_field_declaration_declarator_repeat1",
733            C::ParameterListRepeat1 => "parameter_list_repeat1",
734            C::OldStyleParameterListRepeat1 => "_old_style_parameter_list_repeat1",
735            C::CaseStatementRepeat1 => "case_statement_repeat1",
736            C::GenericExpressionRepeat1 => "generic_expression_repeat1",
737            C::GnuAsmExpressionRepeat1 => "gnu_asm_expression_repeat1",
738            C::GnuAsmOutputOperandListRepeat1 => "gnu_asm_output_operand_list_repeat1",
739            C::GnuAsmInputOperandListRepeat1 => "gnu_asm_input_operand_list_repeat1",
740            C::GnuAsmClobberListRepeat1 => "gnu_asm_clobber_list_repeat1",
741            C::GnuAsmGotoListRepeat1 => "gnu_asm_goto_list_repeat1",
742            C::ArgumentListRepeat1 => "argument_list_repeat1",
743            C::InitializerListRepeat1 => "initializer_list_repeat1",
744            C::InitializerPairRepeat1 => "initializer_pair_repeat1",
745            C::CharLiteralRepeat1 => "char_literal_repeat1",
746            C::ConcatenatedStringRepeat1 => "concatenated_string_repeat1",
747            C::StringLiteralRepeat1 => "string_literal_repeat1",
748            C::FieldIdentifier => "field_identifier",
749            C::StatementIdentifier => "statement_identifier",
750            C::TypeIdentifier => "type_identifier",
751            C::Error => "ERROR",
752        }
753    }
754}
755
756impl From<u16> for C {
757    #[inline]
758    fn from(x: u16) -> Self {
759        num_traits::FromPrimitive::from_u16(x).unwrap_or(Self::Error)
760    }
761}
762
763// C == u16
764impl PartialEq<u16> for C {
765    #[inline]
766    fn eq(&self, x: &u16) -> bool {
767        *self == Into::<Self>::into(*x)
768    }
769}
770
771// u16 == C
772impl PartialEq<C> for u16 {
773    #[inline]
774    fn eq(&self, x: &C) -> bool {
775        *x == *self
776    }
777}