1use oak_core::{ElementType, UniversalElementRole};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
5#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
6pub enum JasminElementType {
7 Root,
9 Class,
11 Method,
13 Field,
15 Instruction,
17 IdentifierNode,
19 StringNode,
21 NumberNode,
23 ErrorNode,
25
26 ClassKw,
28 VersionKw,
30 MethodKw,
32 FieldKw,
34 StringKw,
36 SourceFileKw,
38 StackKw,
40 LocalsKw,
42 EndKw,
44 CompiledKw,
46 FromKw,
48 InnerClassKw,
50 NestMembersKw,
52 BootstrapMethodKw,
54
55 Public,
57 Private,
59 Protected,
61 Static,
63 Super,
65 Final,
67 Abstract,
69 Synchronized,
71 Native,
73 Synthetic,
75 Deprecated,
77 Varargs,
79 Bridge,
81 Enum,
83 Annotation,
85 Strictfp,
87 Interface,
89 Volatile,
91 Transient,
93
94 ALoad0,
96 ALoad1,
98 ALoad2,
100 ALoad3,
102 ILoad0,
104 ILoad1,
106 ILoad2,
108 ILoad3,
110 Ldc,
112 LdcW,
114 Ldc2W,
116 InvokeSpecial,
118 InvokeVirtual,
120 InvokeStatic,
122 InvokeInterface,
124 InvokeDynamic,
126 GetStatic,
128 PutStatic,
130 GetField,
132 PutField,
134 Return,
136 IReturn,
138 AReturn,
140 LReturn,
142 FReturn,
144 DReturn,
146 Nop,
148 Dup,
150 Pop,
152 New,
154
155 LeftBrace,
157 RightBrace,
159 LeftParen,
161 RightParen,
163 LeftBracket,
165 RightBracket,
167 Colon,
169 Semicolon,
171 Dot,
173 Comma,
175 Slash,
177
178 StringLiteral,
180 Number,
182 TypeDescriptor,
184 IdentifierToken,
186 Whitespace,
188 Newline,
190 Comment,
192 Eof,
194 Error,
196}
197
198impl ElementType for JasminElementType {
199 type Role = UniversalElementRole;
200
201 fn role(&self) -> Self::Role {
202 match self {
203 _ => UniversalElementRole::None,
204 }
205 }
206}
207
208impl From<crate::lexer::token_type::JasminTokenType> for JasminElementType {
209 fn from(token: crate::lexer::token_type::JasminTokenType) -> Self {
210 match token {
211 crate::lexer::token_type::JasminTokenType::Root => JasminElementType::Root,
212 crate::lexer::token_type::JasminTokenType::Class => JasminElementType::Class,
213 crate::lexer::token_type::JasminTokenType::Method => JasminElementType::Method,
214 crate::lexer::token_type::JasminTokenType::Field => JasminElementType::Field,
215 crate::lexer::token_type::JasminTokenType::Instruction => JasminElementType::Instruction,
216 crate::lexer::token_type::JasminTokenType::IdentifierNode => JasminElementType::IdentifierNode,
217 crate::lexer::token_type::JasminTokenType::StringNode => JasminElementType::StringNode,
218 crate::lexer::token_type::JasminTokenType::NumberNode => JasminElementType::NumberNode,
219 crate::lexer::token_type::JasminTokenType::ErrorNode => JasminElementType::ErrorNode,
220
221 crate::lexer::token_type::JasminTokenType::ClassKw => JasminElementType::ClassKw,
222 crate::lexer::token_type::JasminTokenType::VersionKw => JasminElementType::VersionKw,
223 crate::lexer::token_type::JasminTokenType::MethodKw => JasminElementType::MethodKw,
224 crate::lexer::token_type::JasminTokenType::FieldKw => JasminElementType::FieldKw,
225 crate::lexer::token_type::JasminTokenType::StringKw => JasminElementType::StringKw,
226 crate::lexer::token_type::JasminTokenType::SourceFileKw => JasminElementType::SourceFileKw,
227 crate::lexer::token_type::JasminTokenType::StackKw => JasminElementType::StackKw,
228 crate::lexer::token_type::JasminTokenType::LocalsKw => JasminElementType::LocalsKw,
229 crate::lexer::token_type::JasminTokenType::EndKw => JasminElementType::EndKw,
230 crate::lexer::token_type::JasminTokenType::CompiledKw => JasminElementType::CompiledKw,
231 crate::lexer::token_type::JasminTokenType::FromKw => JasminElementType::FromKw,
232 crate::lexer::token_type::JasminTokenType::InnerClassKw => JasminElementType::InnerClassKw,
233 crate::lexer::token_type::JasminTokenType::NestMembersKw => JasminElementType::NestMembersKw,
234 crate::lexer::token_type::JasminTokenType::BootstrapMethodKw => JasminElementType::BootstrapMethodKw,
235
236 crate::lexer::token_type::JasminTokenType::Public => JasminElementType::Public,
237 crate::lexer::token_type::JasminTokenType::Private => JasminElementType::Private,
238 crate::lexer::token_type::JasminTokenType::Protected => JasminElementType::Protected,
239 crate::lexer::token_type::JasminTokenType::Static => JasminElementType::Static,
240 crate::lexer::token_type::JasminTokenType::Super => JasminElementType::Super,
241 crate::lexer::token_type::JasminTokenType::Final => JasminElementType::Final,
242 crate::lexer::token_type::JasminTokenType::Abstract => JasminElementType::Abstract,
243 crate::lexer::token_type::JasminTokenType::Synchronized => JasminElementType::Synchronized,
244 crate::lexer::token_type::JasminTokenType::Native => JasminElementType::Native,
245 crate::lexer::token_type::JasminTokenType::Synthetic => JasminElementType::Synthetic,
246 crate::lexer::token_type::JasminTokenType::Deprecated => JasminElementType::Deprecated,
247 crate::lexer::token_type::JasminTokenType::Varargs => JasminElementType::Varargs,
248 crate::lexer::token_type::JasminTokenType::Bridge => JasminElementType::Bridge,
249 crate::lexer::token_type::JasminTokenType::Enum => JasminElementType::Enum,
250 crate::lexer::token_type::JasminTokenType::Annotation => JasminElementType::Annotation,
251 crate::lexer::token_type::JasminTokenType::Strictfp => JasminElementType::Strictfp,
252 crate::lexer::token_type::JasminTokenType::Interface => JasminElementType::Interface,
253 crate::lexer::token_type::JasminTokenType::Volatile => JasminElementType::Volatile,
254 crate::lexer::token_type::JasminTokenType::Transient => JasminElementType::Transient,
255
256 crate::lexer::token_type::JasminTokenType::ALoad0 => JasminElementType::ALoad0,
257 crate::lexer::token_type::JasminTokenType::ALoad1 => JasminElementType::ALoad1,
258 crate::lexer::token_type::JasminTokenType::ALoad2 => JasminElementType::ALoad2,
259 crate::lexer::token_type::JasminTokenType::ALoad3 => JasminElementType::ALoad3,
260 crate::lexer::token_type::JasminTokenType::ILoad0 => JasminElementType::ILoad0,
261 crate::lexer::token_type::JasminTokenType::ILoad1 => JasminElementType::ILoad1,
262 crate::lexer::token_type::JasminTokenType::ILoad2 => JasminElementType::ILoad2,
263 crate::lexer::token_type::JasminTokenType::ILoad3 => JasminElementType::ILoad3,
264 crate::lexer::token_type::JasminTokenType::Ldc => JasminElementType::Ldc,
265 crate::lexer::token_type::JasminTokenType::LdcW => JasminElementType::LdcW,
266 crate::lexer::token_type::JasminTokenType::Ldc2W => JasminElementType::Ldc2W,
267 crate::lexer::token_type::JasminTokenType::InvokeSpecial => JasminElementType::InvokeSpecial,
268 crate::lexer::token_type::JasminTokenType::InvokeVirtual => JasminElementType::InvokeVirtual,
269 crate::lexer::token_type::JasminTokenType::InvokeStatic => JasminElementType::InvokeStatic,
270 crate::lexer::token_type::JasminTokenType::InvokeInterface => JasminElementType::InvokeInterface,
271 crate::lexer::token_type::JasminTokenType::InvokeDynamic => JasminElementType::InvokeDynamic,
272 crate::lexer::token_type::JasminTokenType::GetStatic => JasminElementType::GetStatic,
273 crate::lexer::token_type::JasminTokenType::PutStatic => JasminElementType::PutStatic,
274 crate::lexer::token_type::JasminTokenType::GetField => JasminElementType::GetField,
275 crate::lexer::token_type::JasminTokenType::PutField => JasminElementType::PutField,
276 crate::lexer::token_type::JasminTokenType::Return => JasminElementType::Return,
277 crate::lexer::token_type::JasminTokenType::IReturn => JasminElementType::IReturn,
278 crate::lexer::token_type::JasminTokenType::AReturn => JasminElementType::AReturn,
279 crate::lexer::token_type::JasminTokenType::LReturn => JasminElementType::LReturn,
280 crate::lexer::token_type::JasminTokenType::FReturn => JasminElementType::FReturn,
281 crate::lexer::token_type::JasminTokenType::DReturn => JasminElementType::DReturn,
282 crate::lexer::token_type::JasminTokenType::Nop => JasminElementType::Nop,
283 crate::lexer::token_type::JasminTokenType::Dup => JasminElementType::Dup,
284 crate::lexer::token_type::JasminTokenType::Pop => JasminElementType::Pop,
285 crate::lexer::token_type::JasminTokenType::New => JasminElementType::New,
286
287 crate::lexer::token_type::JasminTokenType::LeftBrace => JasminElementType::LeftBrace,
288 crate::lexer::token_type::JasminTokenType::RightBrace => JasminElementType::RightBrace,
289 crate::lexer::token_type::JasminTokenType::LeftParen => JasminElementType::LeftParen,
290 crate::lexer::token_type::JasminTokenType::RightParen => JasminElementType::RightParen,
291 crate::lexer::token_type::JasminTokenType::LeftBracket => JasminElementType::LeftBracket,
292 crate::lexer::token_type::JasminTokenType::RightBracket => JasminElementType::RightBracket,
293 crate::lexer::token_type::JasminTokenType::Colon => JasminElementType::Colon,
294 crate::lexer::token_type::JasminTokenType::Semicolon => JasminElementType::Semicolon,
295 crate::lexer::token_type::JasminTokenType::Dot => JasminElementType::Dot,
296 crate::lexer::token_type::JasminTokenType::Comma => JasminElementType::Comma,
297 crate::lexer::token_type::JasminTokenType::Slash => JasminElementType::Slash,
298
299 crate::lexer::token_type::JasminTokenType::StringLiteral => JasminElementType::StringLiteral,
300 crate::lexer::token_type::JasminTokenType::Number => JasminElementType::Number,
301 crate::lexer::token_type::JasminTokenType::TypeDescriptor => JasminElementType::TypeDescriptor,
302 crate::lexer::token_type::JasminTokenType::IdentifierToken => JasminElementType::IdentifierToken,
303 crate::lexer::token_type::JasminTokenType::Whitespace => JasminElementType::Whitespace,
304 crate::lexer::token_type::JasminTokenType::Newline => JasminElementType::Newline,
305 crate::lexer::token_type::JasminTokenType::Comment => JasminElementType::Comment,
306 crate::lexer::token_type::JasminTokenType::Eof => JasminElementType::Eof,
307 crate::lexer::token_type::JasminTokenType::Error => JasminElementType::Error,
308 }
309 }
310}