1use oak_core::{SyntaxKind, Token};
2use serde::Serialize;
3
4pub type ObjectiveCToken = Token<ObjectiveCLanguageSyntaxKind>;
5
6#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize)]
7pub enum ObjectiveCLanguageSyntaxKind {
8 Root,
10 InterfaceDeclaration,
11 ImplementationDeclaration,
12 MethodDeclaration,
13 PropertyDeclaration,
14 ProtocolDeclaration,
15 CategoryDeclaration,
16 ClassExtension,
17
18 InterfaceKeyword,
20 ImplementationKeyword,
21 EndKeyword,
22 PropertyKeyword,
23 SynthesizeKeyword,
24 DynamicKeyword,
25 ProtocolKeyword,
26 CategoryKeyword,
27 ImportKeyword,
28 IncludeKeyword,
29 IfKeyword,
30 ElseKeyword,
31 ForKeyword,
32 WhileKeyword,
33 DoKeyword,
34 SwitchKeyword,
35 CaseKeyword,
36 DefaultKeyword,
37 BreakKeyword,
38 ContinueKeyword,
39 ReturnKeyword,
40 VoidKeyword,
41 IntKeyword,
42 FloatKeyword,
43 DoubleKeyword,
44 CharKeyword,
45 BoolKeyword,
46 IdKeyword,
47 SelfKeyword,
48 SuperKeyword,
49 NilKeyword,
50 YesKeyword,
51 NoKeyword,
52
53 LeftParen,
55 RightParen,
56 LeftBrace,
57 RightBrace,
58 LeftBracket,
59 RightBracket,
60 Semicolon,
61 Comma,
62 Dot,
63 Colon,
64 Plus,
65 Minus,
66 Star,
67 Slash,
68 Percent,
69 Equal,
70 EqualEqual,
71 NotEqual,
72 Less,
73 Greater,
74 LessEqual,
75 GreaterEqual,
76 And,
77 Or,
78 Not,
79 Question,
80 At,
81
82 Identifier,
84 IntegerLiteral,
85 FloatLiteral,
86 String,
87 Character,
88
89 Whitespace,
91 Newline,
92 CommentToken,
93 Error,
94 Eof,
95}
96
97impl SyntaxKind for ObjectiveCLanguageSyntaxKind {
98 fn is_trivia(&self) -> bool {
99 matches!(self, Self::Whitespace | Self::Newline | Self::CommentToken)
100 }
101
102 fn is_comment(&self) -> bool {
103 matches!(self, Self::CommentToken)
104 }
105
106 fn is_whitespace(&self) -> bool {
107 matches!(self, Self::Whitespace | Self::Newline)
108 }
109
110 fn is_token_type(&self) -> bool {
111 !matches!(
112 self,
113 Self::Root
114 | Self::InterfaceDeclaration
115 | Self::ImplementationDeclaration
116 | Self::MethodDeclaration
117 | Self::PropertyDeclaration
118 | Self::ProtocolDeclaration
119 | Self::CategoryDeclaration
120 | Self::ClassExtension
121 )
122 }
123
124 fn is_element_type(&self) -> bool {
125 matches!(
126 self,
127 Self::Root
128 | Self::InterfaceDeclaration
129 | Self::ImplementationDeclaration
130 | Self::MethodDeclaration
131 | Self::PropertyDeclaration
132 | Self::ProtocolDeclaration
133 | Self::CategoryDeclaration
134 | Self::ClassExtension
135 )
136 }
137}