1use oak_core::{SyntaxKind, Token};
2
3pub type CSharpToken = Token<CSharpSyntaxKind>;
5
6#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
12pub enum CSharpSyntaxKind {
13 Whitespace,
15 Comment,
17 Identifier,
19 Number,
22 String,
24 Character,
26 VerbatimString,
28 InterpolatedString,
30 NumberLiteral,
32 StringLiteral,
34 CharLiteral,
36 Abstract,
38 As,
40 Base,
42 Bool,
44 Break,
46 Byte,
48 Case,
50 Catch,
52 Char,
54 Checked,
56 Class,
58 Const,
60 Continue,
62 Decimal,
64 Default,
66 Delegate,
68 Do,
70 Double,
72 Else,
74 Enum,
76 Event,
78 Explicit,
80 Extern,
82 False,
84 Finally,
86 Fixed,
88 Float,
90 For,
92 Foreach,
94 Goto,
96 If,
98 Implicit,
100 In,
102 Int,
104 Interface,
106 Internal,
108 Is,
110 Lock,
112 Long,
114 Namespace,
116 New,
118 Null,
120 Object,
122 Operator,
124 Out,
126 Override,
128 Params,
130 Private,
132 Protected,
134 Public,
136 Readonly,
138 Ref,
140 Return,
142 Sbyte,
144 Sealed,
146 Short,
148 Sizeof,
150 Stackalloc,
152 Static,
154 Struct,
156 Switch,
158 This,
160 Throw,
162 True,
164 Try,
166 Typeof,
168 Uint,
170 Ulong,
172 Unchecked,
174 Unsafe,
176 Ushort,
178 Using,
180 Virtual,
182 Void,
184 Volatile,
186 While,
188 AbstractKeyword,
190 AsKeyword,
192 BaseKeyword,
194 BoolKeyword,
196 BreakKeyword,
198 ByteKeyword,
200 CaseKeyword,
202 CatchKeyword,
204 CharKeyword,
206 CheckedKeyword,
208 ClassKeyword,
210 ConstKeyword,
212 ContinueKeyword,
214 DecimalKeyword,
216 DefaultKeyword,
218 DelegateKeyword,
220 DoKeyword,
222 DoubleKeyword,
224 ElseKeyword,
226 EnumKeyword,
228 EventKeyword,
230 ExplicitKeyword,
232 ExternKeyword,
234 FalseKeyword,
236 FinallyKeyword,
238 FixedKeyword,
240 FloatKeyword,
242 ForKeyword,
244 ForeachKeyword,
246 GotoKeyword,
248 IfKeyword,
250 ImplicitKeyword,
252 InKeyword,
254 IntKeyword,
256 InterfaceKeyword,
258 InternalKeyword,
260 IsKeyword,
262 LockKeyword,
264 LongKeyword,
266 NamespaceKeyword,
268 NewKeyword,
270 NullKeyword,
272 ObjectKeyword,
274 OperatorKeyword,
276 OutKeyword,
278 OverrideKeyword,
280 ParamsKeyword,
282 PrivateKeyword,
284 ProtectedKeyword,
286 PublicKeyword,
288 ReadonlyKeyword,
290 RefKeyword,
292 ReturnKeyword,
294 SbyteKeyword,
296 SealedKeyword,
298 ShortKeyword,
300 SizeofKeyword,
302 StackallocKeyword,
304 StaticKeyword,
306 StringKeyword,
308 StructKeyword,
310 SwitchKeyword,
312 ThisKeyword,
314 ThrowKeyword,
316 TrueKeyword,
318 TryKeyword,
320 TypeofKeyword,
322 UintKeyword,
324 UlongKeyword,
326 UncheckedKeyword,
328 UnsafeKeyword,
330 UshortKeyword,
332 UsingKeyword,
334 VirtualKeyword,
336 VoidKeyword,
338 VolatileKeyword,
340 WhileKeyword,
342
343 AddKeyword,
346 AliasKeyword,
348 AscendingKeyword,
350 ByKeyword,
352 DescendingKeyword,
354 FromKeyword,
356 GetKeyword,
358 GlobalKeyword,
360 GroupKeyword,
362 IntoKeyword,
364 JoinKeyword,
366 LetKeyword,
368 OrderbyKeyword,
370 PartialKeyword,
372 RemoveKeyword,
374 SelectKeyword,
376 SetKeyword,
378 ValueKeyword,
380 VarKeyword,
382 WhereKeyword,
384 YieldKeyword,
386
387 Plus,
390 Minus,
392 Star,
394 Slash,
396 Percent,
398 Ampersand,
400 Pipe,
402 Caret,
404 Tilde,
406 BitAnd,
408 BitOr,
410 BitXor,
412 BitNot,
414 LeftShift,
416 RightShift,
418 Equal,
420 NotEqual,
422 Less,
424 LessEqual,
426 Greater,
428 GreaterEqual,
430 LogicalAnd,
432 LogicalOr,
434 LogicalNot,
436 Question,
438 QuestionQuestion,
440 Increment,
442 Decrement,
444 Arrow,
446 Lambda,
448
449 Assign,
452 PlusAssign,
454 MinusAssign,
456 StarAssign,
458 SlashAssign,
460 PercentAssign,
462 AmpersandAssign,
464 PipeAssign,
466 CaretAssign,
468 LeftShiftAssign,
470 RightShiftAssign,
472 QuestionQuestionAssign,
474 AndAssign,
476 OrAssign,
478 XorAssign,
480
481 LeftParen,
484 RightParen,
486 LeftBracket,
488 RightBracket,
490 LeftBrace,
492 RightBrace,
494 Comma,
496 Semicolon,
498 Colon,
500 ColonColon,
502 Dot,
504 QuestionDot,
506 At,
508 Hash,
510 Dollar,
512
513 Newline,
516 Eof,
518 Error,
520
521 Root,
524 CompilationUnit,
526 NamespaceDeclaration,
528 UsingDirective,
530 ClassDeclaration,
532 StructDeclaration,
534 InterfaceDeclaration,
536 EnumDeclaration,
538 DelegateDeclaration,
540 MethodDeclaration,
542 PropertyDeclaration,
544 FieldDeclaration,
546 EventDeclaration,
548 IndexerDeclaration,
550 ConstructorDeclaration,
552 DestructorDeclaration,
554 OperatorDeclaration,
556 ConversionOperatorDeclaration,
558 Parameter,
560 TypeParameter,
562 Constraint,
564 Attribute,
566 AttributeList,
568 Block,
570 ExpressionStatement,
572 IfStatement,
574 SwitchStatement,
576 WhileStatement,
578 ForStatement,
580 ForeachStatement,
582 DoStatement,
584 TryStatement,
586 CatchClause,
588 FinallyClause,
590 ThrowStatement,
592 ReturnStatement,
594 BreakStatement,
596 ContinueStatement,
598 GotoStatement,
600 LabeledStatement,
602 LockStatement,
604 UsingStatement,
606 FixedStatement,
608 UnsafeStatement,
610 CheckedStatement,
612 UncheckedStatement,
614 YieldStatement,
616 LocalDeclarationStatement,
618 BinaryExpression,
620 UnaryExpression,
622 AssignmentExpression,
624 ConditionalExpression,
626 InvocationExpression,
628 MemberAccessExpression,
630 ElementAccessExpression,
632 CastExpression,
634 AsExpression,
636 IsExpression,
638 TypeOfExpression,
640 SizeOfExpression,
642 DefaultExpression,
644 LiteralExpression,
646 ThisExpression,
648 BaseExpression,
650 IdentifierName,
652 QualifiedName,
654 GenericName,
656 AliasQualifiedName,
658 PredefinedType,
660 ArrayType,
662 PointerType,
664 NullableType,
666 TupleType,
668 RefType,
670 ArrayCreationExpression,
672 ImplicitArrayCreationExpression,
674 StackAllocArrayCreationExpression,
676 ObjectCreationExpression,
678 AnonymousObjectCreationExpression,
680 ArrayInitializerExpression,
682 CollectionInitializerExpression,
684 ComplexElementInitializerExpression,
686 ObjectInitializerExpression,
688 MemberInitializerExpression,
690 LambdaExpression,
692 AnonymousMethodExpression,
694 QueryExpression,
696 QueryBody,
698 FromClause,
700 LetClause,
702 WhereClause,
704 JoinClause,
706 JoinIntoClause,
708 OrderByClause,
710 Ordering,
712 SelectClause,
714 GroupClause,
716 QueryContinuation,
718 OmittedArraySizeExpression,
720 InterpolatedStringExpression,
722 InterpolatedStringText,
724 Interpolation,
726 InterpolationAlignmentClause,
728 InterpolationFormatClause,
730 GlobalStatement,
732 SimpleLambdaExpression,
734 ParenthesizedLambdaExpression,
736 InitializerExpression,
738 ImplicitElementAccess,
740 PostfixUnaryExpression,
742 PrefixUnaryExpression,
744 AwaitExpression,
746 NameColon,
748 DeclarationExpression,
750 TupleExpression,
752 TupleElement,
754 SingleVariableDesignation,
756 ParenthesizedVariableDesignation,
758 DiscardDesignation,
760 RefExpression,
762 RefTypeExpression,
764 RefValueExpression,
766 MakeRefExpression,
768 CheckedExpression,
770 UncheckedExpression,
772 DefaultLiteralExpression,
774 ConditionalAccessExpression,
776 MemberBindingExpression,
778 ElementBindingExpression,
780 ImplicitStackAllocArrayCreationExpression,
781 IsPatternExpression,
782 ThrowExpression,
783 WhenClause,
784 ConstantPattern,
785 DeclarationPattern,
786 VarPattern,
787 RecursivePattern,
788 PositionalPatternClause,
789 PropertyPatternClause,
790 Subpattern,
791 SwitchExpression,
793 SwitchExpressionArm,
795 CasePatternSwitchLabel,
797 CaseSwitchLabel,
799 DiscardPattern,
801 TuplePattern,
803 ParenthesizedPattern,
805 RelationalPattern,
807 TypePattern,
809 BinaryPattern,
811 UnaryPattern,
813 SlicePattern,
815 RangeExpression,
817 IndexExpression,
819 WithExpression,
821 AnonymousObjectMemberDeclarator,
823 ArgumentList,
825 BracketedArgumentList,
827 Argument,
829 NameEquals,
831 TypeArgumentList,
833 TypeParameterList,
835 TypeParameterConstraintClause,
837 ConstructorConstraint,
839 ClassOrStructConstraint,
841 TypeConstraint,
843 BaseList,
845 SimpleBaseType,
847 PrimaryConstructorBaseType,
849 AccessorList,
851 AccessorDeclaration,
853 ParameterList,
855 BracketedParameterList,
857 ArrowExpressionClause,
859 EqualsValueClause,
861 VariableDeclaration,
863 VariableDeclarator,
865 SeparatedSyntaxList,
867 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}