1use oak_core::{ElementType, Parser, UniversalElementRole};
2#[cfg(feature = "serde")]
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
6#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
7pub enum ActionScriptElementType {
8 Whitespace,
9 Newline,
10 Comment,
11 Identifier,
12 StringLiteral,
13 CharLiteral,
14 NumberLiteral,
15 BooleanLiteral,
16 NullLiteral,
17 As,
18 Break,
19 Case,
20 Catch,
21 Class,
22 Const,
23 Continue,
24 Default,
25 Delete,
26 Do,
27 Else,
28 Extends,
29 False,
30 Finally,
31 For,
32 Function,
33 If,
34 Implements,
35 Import,
36 In,
37 Instanceof,
38 Interface,
39 Internal,
40 Is,
41 Native,
42 New,
43 Null,
44 Package,
45 Private,
46 Protected,
47 Public,
48 Return,
49 Static,
50 Super,
51 Switch,
52 This,
53 Throw,
54 True,
55 Try,
56 Typeof,
57 Use,
58 Var,
59 Void,
60 While,
61 With,
62 Each,
63 Get,
64 Set,
65 Namespace,
66 Include,
67 Dynamic,
68 Final,
69 Override,
70 Array,
71 Boolean,
72 Date,
73 Number,
74 ObjectType,
75 RegExp,
76 StringType,
77 Uint,
78 Vector,
79 VoidType,
80 Xml,
81 XmlList,
82 Plus,
83 Minus,
84 Star,
85 Slash,
86 Percent,
87 Equal,
88 EqualEqual,
89 EqualEqualEqual,
90 NotEqual,
91 NotEqualEqual,
92 LessThan,
93 LessEqual,
94 GreaterThan,
95 GreaterEqual,
96 LogicalAnd,
97 LogicalOr,
98 LogicalNot,
99 BitwiseAnd,
100 BitwiseOr,
101 BitwiseXor,
102 BitwiseNot,
103 LeftShift,
104 RightShift,
105 UnsignedRightShift,
106 Increment,
107 Decrement,
108 PlusAssign,
109 MinusAssign,
110 StarAssign,
111 SlashAssign,
112 PercentAssign,
113 LeftShiftAssign,
114 RightShiftAssign,
115 UnsignedRightShiftAssign,
116 BitwiseAndAssign,
117 BitwiseOrAssign,
118 BitwiseXorAssign,
119 Question,
120 Colon,
121 Dot,
122 Arrow,
123 LeftParen,
124 RightParen,
125 LeftBrace,
126 RightBrace,
127 LeftBracket,
128 RightBracket,
129 Semicolon,
130 Comma,
131 At,
132 Hash,
133 Dollar,
134 Ampersand,
135 Backslash,
136 Quote,
137 DoubleQuote,
138 Backtick,
139 Eof,
140 Program,
141 Block,
142 Variable,
143 FunctionCall,
144 MethodCall,
145 PropertyAccess,
146 ArrayAccess,
147 ParameterList,
148 UseItem,
149 ModuleItem,
150 StructItem,
151 EnumItem,
152 FunctionType,
153 Root,
154 Statement,
155 Expression,
156 Assignment,
157 ConditionalExpression,
158 BinaryExpression,
159 UnaryExpression,
160 IfStatement,
161 ForStatement,
162 WhileStatement,
163 DoWhileStatement,
164 SwitchStatement,
165 TryStatement,
166 ThrowStatement,
167 ReturnStatement,
168 BreakStatement,
169 ContinueStatement,
170 Error,
171 LiteralExpression,
172 IdentifierExpression,
173 ParenthesizedExpression,
174 SourceFile,
175 BlockExpression,
176 LetStatement,
177 IfExpression,
178 WhileExpression,
179 LoopExpression,
180 ForExpression,
181 CallExpression,
182 IndexExpression,
183 FieldExpression,
184}
185
186impl ElementType for ActionScriptElementType {
187 type Role = UniversalElementRole;
188
189 fn role(&self) -> Self::Role {
190 match self {
191 Self::Root => UniversalElementRole::Root,
192 Self::SourceFile => UniversalElementRole::Root,
193 Self::Error => UniversalElementRole::Error,
194 _ => UniversalElementRole::None,
195 }
196 }
197}
198
199impl From<crate::lexer::token_type::ActionScriptTokenType> for ActionScriptElementType {
200 fn from(token: crate::lexer::token_type::ActionScriptTokenType) -> Self {
201 unsafe { std::mem::transmute(token) }
202 }
203}