oak_csharp/kind/
mod.rs

1use oak_core::{SyntaxKind, Token};
2
3/// C# token type
4pub type CSharpToken = Token<CSharpSyntaxKind>;
5
6/// Represents all possible syntax kinds in the C# programming language.
7///
8/// This enum defines the fundamental building blocks of C# syntax,
9/// including trivia, literals, identifiers, keywords, operators,
10/// delimiters, and composite syntax nodes.
11#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
12pub enum CSharpSyntaxKind {
13    /// Whitespace characters (spaces, tabs)
14    Whitespace,
15    /// Comments (both single-line and multi-line)
16    Comment,
17    /// Identifiers (variable names, function names, etc.)
18    Identifier,
19    // Literals
20    /// Number literals (integer and floating-point)
21    Number,
22    /// String literals (e.g., "hello")
23    String,
24    /// Character literals (e.g., 'a')
25    Character,
26    /// Verbatim string literals (e.g., @"hello")
27    VerbatimString,
28    /// Interpolated string literals (e.g., $"hello {name}")
29    InterpolatedString,
30    /// Number literals
31    NumberLiteral,
32    /// String literals
33    StringLiteral,
34    /// Character literals
35    CharLiteral,
36    /// Abstract keyword
37    Abstract,
38    /// As keyword
39    As,
40    /// Base keyword
41    Base,
42    /// Bool keyword
43    Bool,
44    /// Break keyword
45    Break,
46    /// Byte keyword
47    Byte,
48    /// Case keyword
49    Case,
50    /// Catch keyword
51    Catch,
52    /// Char keyword
53    Char,
54    /// Checked keyword
55    Checked,
56    /// Class keyword
57    Class,
58    /// Const keyword
59    Const,
60    /// Continue keyword
61    Continue,
62    /// Decimal keyword
63    Decimal,
64    /// Default keyword
65    Default,
66    /// Delegate keyword
67    Delegate,
68    /// Do keyword
69    Do,
70    /// Double keyword
71    Double,
72    /// Else keyword
73    Else,
74    /// Enum keyword
75    Enum,
76    /// Event keyword
77    Event,
78    /// Explicit keyword
79    Explicit,
80    /// Extern keyword
81    Extern,
82    /// False keyword
83    False,
84    /// Finally keyword
85    Finally,
86    /// Fixed keyword
87    Fixed,
88    /// Float keyword
89    Float,
90    /// For keyword
91    For,
92    /// Foreach keyword
93    Foreach,
94    /// Goto keyword
95    Goto,
96    /// If keyword
97    If,
98    /// Implicit keyword
99    Implicit,
100    /// In keyword
101    In,
102    /// Int keyword
103    Int,
104    /// Interface keyword
105    Interface,
106    /// Internal keyword
107    Internal,
108    /// Is keyword
109    Is,
110    /// Lock keyword
111    Lock,
112    /// Long keyword
113    Long,
114    /// Namespace keyword
115    Namespace,
116    /// New keyword
117    New,
118    /// Null keyword
119    Null,
120    /// Object keyword
121    Object,
122    /// Operator keyword
123    Operator,
124    /// Out keyword
125    Out,
126    /// Override keyword
127    Override,
128    /// Params keyword
129    Params,
130    /// Private keyword
131    Private,
132    /// Protected keyword
133    Protected,
134    /// Public keyword
135    Public,
136    /// Readonly keyword
137    Readonly,
138    /// Ref keyword
139    Ref,
140    /// Return keyword
141    Return,
142    /// Sbyte keyword
143    Sbyte,
144    /// Sealed keyword
145    Sealed,
146    /// Short keyword
147    Short,
148    /// Sizeof keyword
149    Sizeof,
150    /// Stackalloc keyword
151    Stackalloc,
152    /// Static keyword
153    Static,
154    /// Struct keyword
155    Struct,
156    /// Switch keyword
157    Switch,
158    /// This keyword
159    This,
160    /// Throw keyword
161    Throw,
162    /// True keyword
163    True,
164    /// Try keyword
165    Try,
166    /// Typeof keyword
167    Typeof,
168    /// Uint keyword
169    Uint,
170    /// Ulong keyword
171    Ulong,
172    /// Unchecked keyword
173    Unchecked,
174    /// Unsafe keyword
175    Unsafe,
176    /// Ushort keyword
177    Ushort,
178    /// Using keyword
179    Using,
180    /// Virtual keyword
181    Virtual,
182    /// Void keyword
183    Void,
184    /// Volatile keyword
185    Volatile,
186    /// While keyword
187    While,
188    /// Abstract keyword
189    AbstractKeyword,
190    /// As keyword
191    AsKeyword,
192    /// Base keyword
193    BaseKeyword,
194    /// Bool keyword
195    BoolKeyword,
196    /// Break keyword
197    BreakKeyword,
198    /// Byte keyword
199    ByteKeyword,
200    /// Case keyword
201    CaseKeyword,
202    /// Catch keyword
203    CatchKeyword,
204    /// Char keyword
205    CharKeyword,
206    /// Checked keyword
207    CheckedKeyword,
208    /// Class keyword
209    ClassKeyword,
210    /// Const keyword
211    ConstKeyword,
212    /// Continue keyword
213    ContinueKeyword,
214    /// Decimal keyword
215    DecimalKeyword,
216    /// Default keyword
217    DefaultKeyword,
218    /// Delegate keyword
219    DelegateKeyword,
220    /// Do keyword
221    DoKeyword,
222    /// Double keyword
223    DoubleKeyword,
224    /// Else keyword
225    ElseKeyword,
226    /// Enum keyword
227    EnumKeyword,
228    /// Event keyword
229    EventKeyword,
230    /// Explicit keyword
231    ExplicitKeyword,
232    /// Extern keyword
233    ExternKeyword,
234    /// False keyword
235    FalseKeyword,
236    /// Finally keyword
237    FinallyKeyword,
238    /// Fixed keyword
239    FixedKeyword,
240    /// Float keyword
241    FloatKeyword,
242    /// For keyword
243    ForKeyword,
244    /// Foreach keyword
245    ForeachKeyword,
246    /// Goto keyword
247    GotoKeyword,
248    /// If keyword
249    IfKeyword,
250    /// Implicit keyword
251    ImplicitKeyword,
252    /// In keyword
253    InKeyword,
254    /// Int keyword
255    IntKeyword,
256    /// Interface keyword
257    InterfaceKeyword,
258    /// Internal keyword
259    InternalKeyword,
260    /// Is keyword
261    IsKeyword,
262    /// Lock keyword
263    LockKeyword,
264    /// Long keyword
265    LongKeyword,
266    /// Namespace keyword
267    NamespaceKeyword,
268    /// New keyword
269    NewKeyword,
270    /// Null keyword
271    NullKeyword,
272    /// Object keyword
273    ObjectKeyword,
274    /// Operator keyword
275    OperatorKeyword,
276    /// Out keyword
277    OutKeyword,
278    /// Override keyword
279    OverrideKeyword,
280    /// Params keyword
281    ParamsKeyword,
282    /// Private keyword
283    PrivateKeyword,
284    /// Protected keyword
285    ProtectedKeyword,
286    /// Public keyword
287    PublicKeyword,
288    /// Readonly keyword
289    ReadonlyKeyword,
290    /// Ref keyword
291    RefKeyword,
292    /// Return keyword
293    ReturnKeyword,
294    /// Sbyte keyword
295    SbyteKeyword,
296    /// Sealed keyword
297    SealedKeyword,
298    /// Short keyword
299    ShortKeyword,
300    /// Sizeof keyword
301    SizeofKeyword,
302    /// Stackalloc keyword
303    StackallocKeyword,
304    /// Static keyword
305    StaticKeyword,
306    /// String keyword
307    StringKeyword,
308    /// Struct keyword
309    StructKeyword,
310    /// Switch keyword
311    SwitchKeyword,
312    /// This keyword
313    ThisKeyword,
314    /// Throw keyword
315    ThrowKeyword,
316    /// True keyword
317    TrueKeyword,
318    /// Try keyword
319    TryKeyword,
320    /// Typeof keyword
321    TypeofKeyword,
322    /// Uint keyword
323    UintKeyword,
324    /// Ulong keyword
325    UlongKeyword,
326    /// Unchecked keyword
327    UncheckedKeyword,
328    /// Unsafe keyword
329    UnsafeKeyword,
330    /// Ushort keyword
331    UshortKeyword,
332    /// Using keyword
333    UsingKeyword,
334    /// Virtual keyword
335    VirtualKeyword,
336    /// Void keyword
337    VoidKeyword,
338    /// Volatile keyword
339    VolatileKeyword,
340    /// While keyword
341    WhileKeyword,
342
343    // Contextual keywords
344    /// Add keyword
345    AddKeyword,
346    /// Alias keyword
347    AliasKeyword,
348    /// Ascending keyword
349    AscendingKeyword,
350    /// By keyword
351    ByKeyword,
352    /// Descending keyword
353    DescendingKeyword,
354    /// From keyword
355    FromKeyword,
356    /// Get keyword
357    GetKeyword,
358    /// Global keyword
359    GlobalKeyword,
360    /// Group keyword
361    GroupKeyword,
362    /// Into keyword
363    IntoKeyword,
364    /// Join keyword
365    JoinKeyword,
366    /// Let keyword
367    LetKeyword,
368    /// Orderby keyword
369    OrderbyKeyword,
370    /// Partial keyword
371    PartialKeyword,
372    /// Remove keyword
373    RemoveKeyword,
374    /// Select keyword
375    SelectKeyword,
376    /// Set keyword
377    SetKeyword,
378    /// Value keyword
379    ValueKeyword,
380    /// Var keyword
381    VarKeyword,
382    /// Where keyword
383    WhereKeyword,
384    /// Yield keyword
385    YieldKeyword,
386
387    // Operators
388    /// Plus operator: +
389    Plus,
390    /// Minus operator: -
391    Minus,
392    /// Multiplication operator: *
393    Star,
394    /// Division operator: /
395    Slash,
396    /// Modulo operator: %
397    Percent,
398    /// Ampersand operator: &
399    Ampersand,
400    /// Bitwise OR operator: |
401    Pipe,
402    /// Bitwise XOR operator: ^
403    Caret,
404    /// Bitwise NOT operator: ~
405    Tilde,
406    /// Bitwise AND operator: &
407    BitAnd,
408    /// Bitwise OR operator: |
409    BitOr,
410    /// Bitwise XOR operator: ^
411    BitXor,
412    /// Bitwise NOT operator: ~
413    BitNot,
414    /// Left shift operator: <<
415    LeftShift,
416    /// Right shift operator: >>
417    RightShift,
418    /// Equality operator: ==
419    Equal,
420    /// Inequality operator: !=
421    NotEqual,
422    /// Less-than operator: <
423    Less,
424    /// Less-than-or-equal operator: <=
425    LessEqual,
426    /// Greater-than operator: >
427    Greater,
428    /// Greater-than-or-equal operator: >=
429    GreaterEqual,
430    /// Logical AND operator: &&
431    LogicalAnd,
432    /// Logical OR operator: ||
433    LogicalOr,
434    /// Logical NOT operator: !
435    LogicalNot,
436    /// Ternary operator: ?
437    Question,
438    /// Null-coalescing operator: ??
439    QuestionQuestion,
440    /// Increment operator: ++
441    Increment,
442    /// Decrement operator: --
443    Decrement,
444    /// Arrow operator: ->
445    Arrow,
446    /// Lambda operator: =>
447    Lambda,
448
449    // Assignment operators
450    /// Assignment operator: =
451    Assign,
452    /// Plus-assignment operator: +=
453    PlusAssign,
454    /// Minus-assignment operator: -=
455    MinusAssign,
456    /// Multiply-assignment operator: *=
457    StarAssign,
458    /// Divide-assignment operator: /=
459    SlashAssign,
460    /// Modulo-assignment operator: %=
461    PercentAssign,
462    /// AND-assignment operator: &=
463    AmpersandAssign,
464    /// OR-assignment operator: |=
465    PipeAssign,
466    /// XOR-assignment operator: ^=
467    CaretAssign,
468    /// Left shift-assignment operator: <<=
469    LeftShiftAssign,
470    /// Right shift-assignment operator: >>=
471    RightShiftAssign,
472    /// Null-coalescing-assignment operator: ??=
473    QuestionQuestionAssign,
474    /// AND-assignment operator: &=
475    AndAssign,
476    /// OR-assignment operator: |=
477    OrAssign,
478    /// XOR-assignment operator: ^=
479    XorAssign,
480
481    // Delimiters
482    /// Left parenthesis: (
483    LeftParen,
484    /// Right parenthesis: )
485    RightParen,
486    /// Left bracket: [
487    LeftBracket,
488    /// Right bracket: ]
489    RightBracket,
490    /// Left brace: {
491    LeftBrace,
492    /// Right brace: }
493    RightBrace,
494    /// Comma: ,
495    Comma,
496    /// Semicolon: ;
497    Semicolon,
498    /// Colon: :
499    Colon,
500    /// Double colon: ::
501    ColonColon,
502    /// Dot operator: .
503    Dot,
504    /// Null-conditional operator: ?.
505    QuestionDot,
506    /// At symbol: @
507    At,
508    /// Hash symbol: #
509    Hash,
510    /// Dollar symbol: $
511    Dollar,
512
513    // Special
514    /// Newline characters
515    Newline,
516    /// End of file marker
517    Eof,
518    /// Error token
519    Error,
520
521    // Syntax nodes
522    /// Root node of the syntax tree
523    Root,
524    /// Compilation unit (source file)
525    CompilationUnit,
526    /// Namespace declaration
527    NamespaceDeclaration,
528    /// Using directive
529    UsingDirective,
530    /// Class declaration
531    ClassDeclaration,
532    /// Struct declaration
533    StructDeclaration,
534    /// Interface declaration
535    InterfaceDeclaration,
536    /// Enum declaration
537    EnumDeclaration,
538    /// Delegate declaration
539    DelegateDeclaration,
540    /// Method declaration
541    MethodDeclaration,
542    /// Property declaration
543    PropertyDeclaration,
544    /// Field declaration
545    FieldDeclaration,
546    /// Event declaration
547    EventDeclaration,
548    /// Indexer declaration
549    IndexerDeclaration,
550    /// Constructor declaration
551    ConstructorDeclaration,
552    /// Destructor declaration
553    DestructorDeclaration,
554    /// Operator declaration
555    OperatorDeclaration,
556    /// Conversion operator declaration
557    ConversionOperatorDeclaration,
558    /// Parameter
559    Parameter,
560    /// Type parameter
561    TypeParameter,
562    /// Constraint
563    Constraint,
564    /// Attribute
565    Attribute,
566    /// Attribute list
567    AttributeList,
568    /// Block statement
569    Block,
570    /// Expression statement
571    ExpressionStatement,
572    /// If statement
573    IfStatement,
574    /// Switch statement
575    SwitchStatement,
576    /// While statement
577    WhileStatement,
578    /// For statement
579    ForStatement,
580    /// Foreach statement
581    ForeachStatement,
582    /// Do-while statement
583    DoStatement,
584    /// Try statement
585    TryStatement,
586    /// Catch clause
587    CatchClause,
588    /// Finally clause
589    FinallyClause,
590    /// Throw statement
591    ThrowStatement,
592    /// Return statement
593    ReturnStatement,
594    /// Break statement
595    BreakStatement,
596    /// Continue statement
597    ContinueStatement,
598    /// Goto statement
599    GotoStatement,
600    /// Labeled statement
601    LabeledStatement,
602    /// Lock statement
603    LockStatement,
604    /// Using statement
605    UsingStatement,
606    /// Fixed statement
607    FixedStatement,
608    /// Unsafe statement
609    UnsafeStatement,
610    /// Checked statement
611    CheckedStatement,
612    /// Unchecked statement
613    UncheckedStatement,
614    /// Yield statement
615    YieldStatement,
616    /// Local declaration statement
617    LocalDeclarationStatement,
618    /// Binary expression
619    BinaryExpression,
620    /// Unary expression
621    UnaryExpression,
622    /// Assignment expression
623    AssignmentExpression,
624    /// Conditional expression (ternary)
625    ConditionalExpression,
626    /// Method invocation expression
627    InvocationExpression,
628    /// Member access expression
629    MemberAccessExpression,
630    /// Element access expression
631    ElementAccessExpression,
632    /// Cast expression
633    CastExpression,
634    /// As expression
635    AsExpression,
636    /// Is expression
637    IsExpression,
638    /// Typeof expression
639    TypeOfExpression,
640    /// Sizeof expression
641    SizeOfExpression,
642    /// Default value expression
643    DefaultExpression,
644    /// Literal expression
645    LiteralExpression,
646    /// This expression
647    ThisExpression,
648    /// Base expression
649    BaseExpression,
650    /// Identifier name
651    IdentifierName,
652    /// Qualified name
653    QualifiedName,
654    /// Generic name
655    GenericName,
656    /// Alias qualified name
657    AliasQualifiedName,
658    /// Predefined type
659    PredefinedType,
660    /// Array type
661    ArrayType,
662    /// Pointer type
663    PointerType,
664    /// Nullable type
665    NullableType,
666    /// Tuple type
667    TupleType,
668    /// Ref type
669    RefType,
670    /// Array creation expression
671    ArrayCreationExpression,
672    /// Implicit array creation expression
673    ImplicitArrayCreationExpression,
674    /// Stack alloc array creation expression
675    StackAllocArrayCreationExpression,
676    /// Object creation expression
677    ObjectCreationExpression,
678    /// Anonymous object creation expression
679    AnonymousObjectCreationExpression,
680    /// Array initializer expression
681    ArrayInitializerExpression,
682    /// Collection initializer expression
683    CollectionInitializerExpression,
684    /// Complex element initializer expression
685    ComplexElementInitializerExpression,
686    /// Object initializer expression
687    ObjectInitializerExpression,
688    /// Member initializer expression
689    MemberInitializerExpression,
690    /// Lambda expression
691    LambdaExpression,
692    /// Anonymous method expression
693    AnonymousMethodExpression,
694    /// Query expression
695    QueryExpression,
696    /// Query body
697    QueryBody,
698    /// From clause
699    FromClause,
700    /// Let clause
701    LetClause,
702    /// Where clause
703    WhereClause,
704    /// Join clause
705    JoinClause,
706    /// Join into clause
707    JoinIntoClause,
708    /// Order by clause
709    OrderByClause,
710    /// Ordering
711    Ordering,
712    /// Select clause
713    SelectClause,
714    /// Group clause
715    GroupClause,
716    /// Query continuation
717    QueryContinuation,
718    /// Omitted array size expression
719    OmittedArraySizeExpression,
720    /// Interpolated string expression
721    InterpolatedStringExpression,
722    /// Interpolated string text
723    InterpolatedStringText,
724    /// Interpolation
725    Interpolation,
726    /// Interpolation alignment clause
727    InterpolationAlignmentClause,
728    /// Interpolation format clause
729    InterpolationFormatClause,
730    /// Global statement
731    GlobalStatement,
732    /// Simple lambda expression
733    SimpleLambdaExpression,
734    /// Parenthesized lambda expression
735    ParenthesizedLambdaExpression,
736    /// Initializer expression
737    InitializerExpression,
738    /// Implicit element access
739    ImplicitElementAccess,
740    /// Postfix unary expression
741    PostfixUnaryExpression,
742    /// Prefix unary expression
743    PrefixUnaryExpression,
744    /// Await expression
745    AwaitExpression,
746    /// Name colon
747    NameColon,
748    /// Declaration expression
749    DeclarationExpression,
750    /// Tuple expression
751    TupleExpression,
752    /// Tuple element
753    TupleElement,
754    /// Single variable designation
755    SingleVariableDesignation,
756    /// Parenthesized variable designation
757    ParenthesizedVariableDesignation,
758    /// Discard designation
759    DiscardDesignation,
760    /// Ref expression
761    RefExpression,
762    /// Ref type expression
763    RefTypeExpression,
764    /// Ref value expression
765    RefValueExpression,
766    /// Make ref expression
767    MakeRefExpression,
768    /// Checked expression
769    CheckedExpression,
770    /// Unchecked expression
771    UncheckedExpression,
772    /// Default literal expression
773    DefaultLiteralExpression,
774    /// Conditional access expression
775    ConditionalAccessExpression,
776    /// Member binding expression
777    MemberBindingExpression,
778    /// Element binding expression
779    ElementBindingExpression,
780    ImplicitStackAllocArrayCreationExpression,
781    IsPatternExpression,
782    ThrowExpression,
783    WhenClause,
784    ConstantPattern,
785    DeclarationPattern,
786    VarPattern,
787    RecursivePattern,
788    PositionalPatternClause,
789    PropertyPatternClause,
790    Subpattern,
791    /// Switch expression
792    SwitchExpression,
793    /// Switch expression arm
794    SwitchExpressionArm,
795    /// Case pattern switch label
796    CasePatternSwitchLabel,
797    /// Case switch label
798    CaseSwitchLabel,
799    /// Discard pattern
800    DiscardPattern,
801    /// Tuple pattern
802    TuplePattern,
803    /// Parenthesized pattern
804    ParenthesizedPattern,
805    /// Relational pattern
806    RelationalPattern,
807    /// Type pattern
808    TypePattern,
809    /// Binary pattern
810    BinaryPattern,
811    /// Unary pattern
812    UnaryPattern,
813    /// Slice pattern
814    SlicePattern,
815    /// Range expression
816    RangeExpression,
817    /// Index expression
818    IndexExpression,
819    /// With expression
820    WithExpression,
821    /// Anonymous object member declarator
822    AnonymousObjectMemberDeclarator,
823    /// Argument list
824    ArgumentList,
825    /// Bracketed argument list
826    BracketedArgumentList,
827    /// Argument
828    Argument,
829    /// Name equals
830    NameEquals,
831    /// Type argument list
832    TypeArgumentList,
833    /// Type parameter list
834    TypeParameterList,
835    /// Type parameter constraint clause
836    TypeParameterConstraintClause,
837    /// Constructor constraint
838    ConstructorConstraint,
839    /// Class or struct constraint
840    ClassOrStructConstraint,
841    /// Type constraint
842    TypeConstraint,
843    /// Base list
844    BaseList,
845    /// Simple base type
846    SimpleBaseType,
847    /// Primary constructor base type
848    PrimaryConstructorBaseType,
849    /// Accessor list
850    AccessorList,
851    /// Accessor declaration
852    AccessorDeclaration,
853    /// Parameter list
854    ParameterList,
855    /// Bracketed parameter list
856    BracketedParameterList,
857    /// Arrow expression clause
858    ArrowExpressionClause,
859    /// Equals value clause
860    EqualsValueClause,
861    /// Variable declaration
862    VariableDeclaration,
863    /// Variable declarator
864    VariableDeclarator,
865    /// Separated syntax list
866    SeparatedSyntaxList,
867    /// Syntax list
868    SyntaxList,
869}
870
871impl SyntaxKind for CSharpSyntaxKind {
872    fn is_trivia(&self) -> bool {
873        matches!(self, Self::Whitespace | Self::Comment | Self::Newline)
874    }
875
876    fn is_comment(&self) -> bool {
877        matches!(self, Self::Comment)
878    }
879
880    fn is_whitespace(&self) -> bool {
881        matches!(self, Self::Whitespace | Self::Newline)
882    }
883
884    fn is_token_type(&self) -> bool {
885        !matches!(
886            self,
887            Self::Root
888                | Self::CompilationUnit
889                | Self::NamespaceDeclaration
890                | Self::ClassDeclaration
891                | Self::StructDeclaration
892                | Self::InterfaceDeclaration
893                | Self::EnumDeclaration
894                | Self::DelegateDeclaration
895                | Self::MethodDeclaration
896                | Self::PropertyDeclaration
897                | Self::FieldDeclaration
898                | Self::EventDeclaration
899                | Self::IndexerDeclaration
900                | Self::ConstructorDeclaration
901                | Self::DestructorDeclaration
902                | Self::OperatorDeclaration
903                | Self::ConversionOperatorDeclaration
904                | Self::Parameter
905                | Self::TypeParameter
906                | Self::Constraint
907                | Self::Attribute
908                | Self::AttributeList
909                | Self::Block
910                | Self::ExpressionStatement
911                | Self::IfStatement
912                | Self::SwitchStatement
913                | Self::WhileStatement
914                | Self::ForStatement
915                | Self::ForeachStatement
916                | Self::DoStatement
917                | Self::TryStatement
918                | Self::CatchClause
919                | Self::FinallyClause
920                | Self::ThrowStatement
921                | Self::ReturnStatement
922                | Self::BreakStatement
923                | Self::ContinueStatement
924                | Self::GotoStatement
925                | Self::LabeledStatement
926                | Self::LockStatement
927                | Self::UsingStatement
928                | Self::FixedStatement
929                | Self::UnsafeStatement
930                | Self::CheckedStatement
931                | Self::UncheckedStatement
932                | Self::YieldStatement
933                | Self::LocalDeclarationStatement
934                | Self::BinaryExpression
935                | Self::UnaryExpression
936                | Self::AssignmentExpression
937                | Self::ConditionalExpression
938                | Self::InvocationExpression
939                | Self::MemberAccessExpression
940                | Self::ElementAccessExpression
941                | Self::CastExpression
942                | Self::AsExpression
943                | Self::IsExpression
944                | Self::TypeOfExpression
945                | Self::SizeOfExpression
946                | Self::DefaultExpression
947                | Self::LiteralExpression
948                | Self::ThisExpression
949                | Self::BaseExpression
950                | Self::IdentifierName
951                | Self::QualifiedName
952                | Self::GenericName
953                | Self::AliasQualifiedName
954                | Self::PredefinedType
955                | Self::ArrayType
956                | Self::PointerType
957                | Self::NullableType
958                | Self::TupleType
959                | Self::RefType
960                | Self::ArrayCreationExpression
961                | Self::ImplicitArrayCreationExpression
962                | Self::StackAllocArrayCreationExpression
963                | Self::ObjectCreationExpression
964                | Self::AnonymousObjectCreationExpression
965                | Self::ArrayInitializerExpression
966                | Self::CollectionInitializerExpression
967                | Self::ComplexElementInitializerExpression
968                | Self::ObjectInitializerExpression
969                | Self::MemberInitializerExpression
970                | Self::LambdaExpression
971                | Self::AnonymousMethodExpression
972                | Self::QueryExpression
973                | Self::QueryBody
974                | Self::FromClause
975                | Self::LetClause
976                | Self::WhereClause
977                | Self::JoinClause
978                | Self::JoinIntoClause
979                | Self::OrderByClause
980                | Self::Ordering
981                | Self::SelectClause
982                | Self::GroupClause
983                | Self::QueryContinuation
984                | Self::OmittedArraySizeExpression
985                | Self::InterpolatedStringExpression
986                | Self::InterpolatedStringText
987                | Self::Interpolation
988                | Self::InterpolationAlignmentClause
989                | Self::InterpolationFormatClause
990                | Self::GlobalStatement
991                | Self::SimpleLambdaExpression
992                | Self::ParenthesizedLambdaExpression
993                | Self::InitializerExpression
994                | Self::ImplicitElementAccess
995                | Self::PostfixUnaryExpression
996                | Self::PrefixUnaryExpression
997                | Self::AwaitExpression
998                | Self::NameColon
999                | Self::DeclarationExpression
1000                | Self::TupleExpression
1001                | Self::TupleElement
1002                | Self::SingleVariableDesignation
1003                | Self::ParenthesizedVariableDesignation
1004                | Self::DiscardDesignation
1005                | Self::RefExpression
1006                | Self::RefTypeExpression
1007                | Self::RefValueExpression
1008                | Self::MakeRefExpression
1009                | Self::CheckedExpression
1010                | Self::UncheckedExpression
1011                | Self::DefaultLiteralExpression
1012                | Self::ConditionalAccessExpression
1013                | Self::MemberBindingExpression
1014                | Self::ElementBindingExpression
1015                | Self::ImplicitStackAllocArrayCreationExpression
1016                | Self::IsPatternExpression
1017                | Self::ThrowExpression
1018                | Self::WhenClause
1019                | Self::ConstantPattern
1020                | Self::DeclarationPattern
1021                | Self::VarPattern
1022                | Self::RecursivePattern
1023                | Self::PositionalPatternClause
1024                | Self::PropertyPatternClause
1025                | Self::Subpattern
1026                | Self::SwitchExpression
1027                | Self::SwitchExpressionArm
1028                | Self::DiscardPattern
1029                | Self::TuplePattern
1030                | Self::ParenthesizedPattern
1031                | Self::RelationalPattern
1032                | Self::TypePattern
1033                | Self::BinaryPattern
1034                | Self::UnaryPattern
1035                | Self::SlicePattern
1036                | Self::RangeExpression
1037                | Self::IndexExpression
1038                | Self::WithExpression
1039                | Self::AnonymousObjectMemberDeclarator
1040                | Self::ArgumentList
1041                | Self::BracketedArgumentList
1042                | Self::Argument
1043                | Self::NameEquals
1044                | Self::TypeArgumentList
1045                | Self::TypeParameterList
1046                | Self::TypeParameterConstraintClause
1047                | Self::ConstructorConstraint
1048                | Self::ClassOrStructConstraint
1049                | Self::TypeConstraint
1050                | Self::BaseList
1051                | Self::SimpleBaseType
1052                | Self::PrimaryConstructorBaseType
1053                | Self::AccessorList
1054                | Self::AccessorDeclaration
1055                | Self::ParameterList
1056                | Self::BracketedParameterList
1057                | Self::ArrowExpressionClause
1058                | Self::EqualsValueClause
1059                | Self::VariableDeclaration
1060                | Self::VariableDeclarator
1061                | Self::SeparatedSyntaxList
1062                | Self::SyntaxList
1063        )
1064    }
1065
1066    fn is_element_type(&self) -> bool {
1067        matches!(
1068            self,
1069            Self::Root
1070                | Self::CompilationUnit
1071                | Self::NamespaceDeclaration
1072                | Self::ClassDeclaration
1073                | Self::StructDeclaration
1074                | Self::InterfaceDeclaration
1075                | Self::EnumDeclaration
1076                | Self::DelegateDeclaration
1077                | Self::MethodDeclaration
1078                | Self::PropertyDeclaration
1079                | Self::FieldDeclaration
1080                | Self::EventDeclaration
1081                | Self::IndexerDeclaration
1082                | Self::ConstructorDeclaration
1083                | Self::DestructorDeclaration
1084                | Self::OperatorDeclaration
1085                | Self::ConversionOperatorDeclaration
1086                | Self::Parameter
1087                | Self::TypeParameter
1088                | Self::Constraint
1089                | Self::Attribute
1090                | Self::AttributeList
1091                | Self::Block
1092                | Self::ExpressionStatement
1093                | Self::IfStatement
1094                | Self::SwitchStatement
1095                | Self::WhileStatement
1096                | Self::ForStatement
1097                | Self::ForeachStatement
1098                | Self::DoStatement
1099                | Self::TryStatement
1100                | Self::CatchClause
1101                | Self::FinallyClause
1102                | Self::ThrowStatement
1103                | Self::ReturnStatement
1104                | Self::BreakStatement
1105                | Self::ContinueStatement
1106                | Self::GotoStatement
1107                | Self::LabeledStatement
1108                | Self::LockStatement
1109                | Self::UsingStatement
1110                | Self::FixedStatement
1111                | Self::UnsafeStatement
1112                | Self::CheckedStatement
1113                | Self::UncheckedStatement
1114                | Self::YieldStatement
1115                | Self::LocalDeclarationStatement
1116                | Self::BinaryExpression
1117                | Self::UnaryExpression
1118                | Self::AssignmentExpression
1119                | Self::ConditionalExpression
1120                | Self::InvocationExpression
1121                | Self::MemberAccessExpression
1122                | Self::ElementAccessExpression
1123                | Self::CastExpression
1124                | Self::AsExpression
1125                | Self::IsExpression
1126                | Self::TypeOfExpression
1127                | Self::SizeOfExpression
1128                | Self::DefaultExpression
1129                | Self::LiteralExpression
1130                | Self::ThisExpression
1131                | Self::BaseExpression
1132                | Self::IdentifierName
1133                | Self::QualifiedName
1134                | Self::GenericName
1135                | Self::AliasQualifiedName
1136                | Self::PredefinedType
1137                | Self::ArrayType
1138                | Self::PointerType
1139                | Self::NullableType
1140                | Self::TupleType
1141                | Self::RefType
1142                | Self::ArrayCreationExpression
1143                | Self::ImplicitArrayCreationExpression
1144                | Self::StackAllocArrayCreationExpression
1145                | Self::ObjectCreationExpression
1146                | Self::AnonymousObjectCreationExpression
1147                | Self::ArrayInitializerExpression
1148                | Self::CollectionInitializerExpression
1149                | Self::ComplexElementInitializerExpression
1150                | Self::ObjectInitializerExpression
1151                | Self::MemberInitializerExpression
1152                | Self::LambdaExpression
1153                | Self::AnonymousMethodExpression
1154                | Self::QueryExpression
1155                | Self::QueryBody
1156                | Self::FromClause
1157                | Self::LetClause
1158                | Self::WhereClause
1159                | Self::JoinClause
1160                | Self::JoinIntoClause
1161                | Self::OrderByClause
1162                | Self::Ordering
1163                | Self::SelectClause
1164                | Self::GroupClause
1165                | Self::QueryContinuation
1166                | Self::OmittedArraySizeExpression
1167                | Self::InterpolatedStringExpression
1168                | Self::InterpolatedStringText
1169                | Self::Interpolation
1170                | Self::InterpolationAlignmentClause
1171                | Self::InterpolationFormatClause
1172                | Self::GlobalStatement
1173                | Self::SimpleLambdaExpression
1174                | Self::ParenthesizedLambdaExpression
1175                | Self::InitializerExpression
1176                | Self::ImplicitElementAccess
1177                | Self::PostfixUnaryExpression
1178                | Self::PrefixUnaryExpression
1179                | Self::AwaitExpression
1180                | Self::NameColon
1181                | Self::DeclarationExpression
1182                | Self::TupleExpression
1183                | Self::TupleElement
1184                | Self::SingleVariableDesignation
1185                | Self::ParenthesizedVariableDesignation
1186                | Self::DiscardDesignation
1187                | Self::RefExpression
1188                | Self::RefTypeExpression
1189                | Self::RefValueExpression
1190                | Self::MakeRefExpression
1191                | Self::CheckedExpression
1192                | Self::UncheckedExpression
1193                | Self::DefaultLiteralExpression
1194                | Self::ConditionalAccessExpression
1195                | Self::MemberBindingExpression
1196                | Self::ElementBindingExpression
1197                | Self::ImplicitStackAllocArrayCreationExpression
1198                | Self::IsPatternExpression
1199                | Self::ThrowExpression
1200                | Self::WhenClause
1201                | Self::ConstantPattern
1202                | Self::DeclarationPattern
1203                | Self::VarPattern
1204                | Self::RecursivePattern
1205                | Self::PositionalPatternClause
1206                | Self::PropertyPatternClause
1207                | Self::Subpattern
1208                | Self::SwitchExpression
1209                | Self::SwitchExpressionArm
1210                | Self::DiscardPattern
1211                | Self::TuplePattern
1212                | Self::ParenthesizedPattern
1213                | Self::RelationalPattern
1214                | Self::TypePattern
1215                | Self::BinaryPattern
1216                | Self::UnaryPattern
1217                | Self::SlicePattern
1218                | Self::RangeExpression
1219                | Self::IndexExpression
1220                | Self::WithExpression
1221                | Self::AnonymousObjectMemberDeclarator
1222                | Self::ArgumentList
1223                | Self::BracketedArgumentList
1224                | Self::Argument
1225                | Self::NameEquals
1226                | Self::TypeArgumentList
1227                | Self::TypeParameterList
1228                | Self::TypeParameterConstraintClause
1229                | Self::ConstructorConstraint
1230                | Self::ClassOrStructConstraint
1231                | Self::TypeConstraint
1232                | Self::BaseList
1233                | Self::SimpleBaseType
1234                | Self::PrimaryConstructorBaseType
1235                | Self::AccessorList
1236                | Self::AccessorDeclaration
1237                | Self::ParameterList
1238                | Self::BracketedParameterList
1239                | Self::ArrowExpressionClause
1240                | Self::EqualsValueClause
1241                | Self::VariableDeclaration
1242                | Self::VariableDeclarator
1243                | Self::SeparatedSyntaxList
1244                | Self::SyntaxList
1245        )
1246    }
1247}