1use oak_core::SyntaxKind;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
4pub enum SwiftSyntaxKind {
5 Whitespace,
7 Newline,
8 Comment,
9 Identifier,
10 Error,
11 Eof,
12
13 NumberLiteral,
15 StringLiteral,
16 CharLiteral,
17 BooleanLiteral,
18
19 Class,
22 Struct,
23 Enum,
24 Protocol,
25 Extension,
26 Func,
27 Var,
28 Let,
29 Init,
30 Deinit,
31 Subscript,
32 Typealias,
33 Import,
34
35 If,
37 Else,
38 Switch,
39 Case,
40 Default,
41 For,
42 While,
43 Repeat,
44 Do,
45 Break,
46 Continue,
47 Fallthrough,
48 Return,
49 Throw,
50 Try,
51 Catch,
52 Finally,
53 Guard,
54 Defer,
55
56 Public,
58 Private,
59 Internal,
60 Fileprivate,
61 Open,
62
63 Static,
65 Final,
66 Override,
67 Mutating,
68 Nonmutating,
69 Lazy,
70 Weak,
71 Unowned,
72 Optional,
73 Required,
74 Convenience,
75 Dynamic,
76 Infix,
77 Prefix,
78 Postfix,
79
80 Any,
82 AnyObject,
83 Self_,
84 Type,
85 Protocol_,
86
87 True,
89 False,
90 Nil,
91
92 As,
94 Is,
95 In,
96 Where,
97 Associatedtype,
98 Operator,
99 Precedencegroup,
100 Indirect,
101 Rethrows,
102 Throws,
103 Inout,
104
105 Plus,
107 Minus,
108 Star,
109 Slash,
110 Percent,
111 Equal,
112 NotEqual,
113 Less,
114 Greater,
115 LessEqual,
116 GreaterEqual,
117 LogicalAnd,
118 LogicalOr,
119 LogicalNot,
120 BitAnd,
121 BitOr,
122 BitXor,
123 BitNot,
124 LeftShift,
125 RightShift,
126 Assign,
127 PlusAssign,
128 MinusAssign,
129 StarAssign,
130 SlashAssign,
131 PercentAssign,
132 AndAssign,
133 OrAssign,
134 XorAssign,
135 LeftShiftAssign,
136 RightShiftAssign,
137 Question,
138 QuestionQuestion,
139 Dot,
140 Arrow,
141 Range,
142 ClosedRange,
143
144 LeftParen,
146 RightParen,
147 LeftBracket,
148 RightBracket,
149 LeftBrace,
150 RightBrace,
151 Comma,
152 Semicolon,
153 Colon,
154 At,
155 Hash,
156 Dollar,
157 Underscore,
158 Backslash,
159}
160
161impl SyntaxKind for SwiftSyntaxKind {
162 fn is_trivia(&self) -> bool {
163 matches!(self, Self::Whitespace | Self::Newline | Self::Comment)
164 }
165
166 fn is_comment(&self) -> bool {
167 matches!(self, Self::Comment)
168 }
169
170 fn is_whitespace(&self) -> bool {
171 matches!(self, Self::Whitespace | Self::Newline)
172 }
173
174 fn is_token_type(&self) -> bool {
175 !matches!(self, Self::Error | Self::Eof)
176 }
177
178 fn is_element_type(&self) -> bool {
179 matches!(self, Self::Error | Self::Eof)
180 }
181}