oak_actionscript/kind/
mod.rs

1#[derive(Copy, Clone, Debug, PartialEq, Eq, serde::Serialize)]
2pub enum ActionScriptSyntaxKind {
3    // Basic tokens
4    Whitespace,
5    Newline,
6    Comment,
7
8    // Identifiers and literals
9    Identifier,
10    StringLiteral,
11    CharLiteral,
12    NumberLiteral,
13    BooleanLiteral,
14    NullLiteral,
15
16    // ActionScript keywords
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
63    // Contextual keywords
64    Each,
65    Get,
66    Set,
67    Namespace,
68    Include,
69    Dynamic,
70    Final,
71    Override,
72
73    // Type keywords
74    Array,
75    Boolean,
76    Date,
77    Function_,
78    Number,
79    Object,
80    RegExp,
81    String_,
82    Uint,
83    Vector,
84    Void_,
85    Xml,
86    XmlList,
87
88    // Operators
89    Plus,                     // +
90    Minus,                    // -
91    Star,                     // *
92    Slash,                    // /
93    Percent,                  // %
94    Equal,                    // =
95    EqualEqual,               // ==
96    EqualEqualEqual,          // ===
97    NotEqual,                 // !=
98    NotEqualEqual,            // !==
99    LessThan,                 // <
100    LessEqual,                // <=
101    GreaterThan,              // >
102    GreaterEqual,             // >=
103    LogicalAnd,               // &&
104    LogicalOr,                // ||
105    LogicalNot,               // !
106    BitwiseAnd,               // &
107    BitwiseOr,                // |
108    BitwiseXor,               // ^
109    BitwiseNot,               // ~
110    LeftShift,                // <<
111    RightShift,               // >>
112    UnsignedRightShift,       // >>>
113    Increment,                // ++
114    Decrement,                // --
115    PlusAssign,               // +=
116    MinusAssign,              // -=
117    StarAssign,               // *=
118    SlashAssign,              // /=
119    PercentAssign,            // %=
120    LeftShiftAssign,          // <<=
121    RightShiftAssign,         // >>=
122    UnsignedRightShiftAssign, // >>>=
123    BitwiseAndAssign,         // &=
124    BitwiseOrAssign,          // |=
125    BitwiseXorAssign,         // ^=
126    Question,                 // ?
127    Colon,                    // :
128
129    // Delimiters
130    LeftParen,    // (
131    RightParen,   // )
132    LeftBrace,    // {
133    RightBrace,   // }
134    LeftBracket,  // [
135    RightBracket, // ]
136    Semicolon,    // ;
137    Comma,        // ,
138    Dot,          // .
139    Arrow,        // ->
140
141    // Special characters
142    At,          // @
143    Hash,        // #
144    Dollar,      // $
145    Ampersand,   // &
146    Backslash,   // \
147    Quote,       // '
148    DoubleQuote, // "
149    Backtick,    // `
150
151    // Composite nodes
152    Program,
153    Statement,
154    Expression,
155    Block,
156    ClassDeclaration,
157    InterfaceDeclaration,
158    FunctionDeclaration,
159    VariableDeclaration,
160    ImportStatement,
161    PackageDeclaration,
162    NamespaceDeclaration,
163    Assignment,
164    FunctionCall,
165    MethodCall,
166    PropertyAccess,
167    ArrayAccess,
168    ConditionalExpression,
169    BinaryExpression,
170    UnaryExpression,
171    IfStatement,
172    ForStatement,
173    WhileStatement,
174    DoWhileStatement,
175    SwitchStatement,
176    TryStatement,
177    ThrowStatement,
178    ReturnStatement,
179    BreakStatement,
180    ContinueStatement,
181
182    // Error and EOF
183    Error,
184    Eof,
185}
186
187impl oak_core::SyntaxKind for ActionScriptSyntaxKind {
188    fn is_trivia(&self) -> bool {
189        matches!(self, Self::Whitespace | Self::Newline | Self::Comment)
190    }
191
192    fn is_comment(&self) -> bool {
193        matches!(self, Self::Comment)
194    }
195
196    fn is_whitespace(&self) -> bool {
197        matches!(self, Self::Whitespace | Self::Newline)
198    }
199
200    fn is_token_type(&self) -> bool {
201        !matches!(
202            self,
203            Self::Program
204                | Self::Statement
205                | Self::Expression
206                | Self::Block
207                | Self::ClassDeclaration
208                | Self::InterfaceDeclaration
209                | Self::FunctionDeclaration
210                | Self::VariableDeclaration
211                | Self::ImportStatement
212                | Self::PackageDeclaration
213                | Self::NamespaceDeclaration
214                | Self::Assignment
215                | Self::FunctionCall
216                | Self::MethodCall
217                | Self::PropertyAccess
218                | Self::ArrayAccess
219                | Self::ConditionalExpression
220                | Self::BinaryExpression
221                | Self::UnaryExpression
222                | Self::IfStatement
223                | Self::ForStatement
224                | Self::WhileStatement
225                | Self::DoWhileStatement
226                | Self::SwitchStatement
227                | Self::TryStatement
228                | Self::ThrowStatement
229                | Self::ReturnStatement
230                | Self::BreakStatement
231                | Self::ContinueStatement
232        )
233    }
234
235    fn is_element_type(&self) -> bool {
236        matches!(
237            self,
238            Self::Program
239                | Self::Statement
240                | Self::Expression
241                | Self::Block
242                | Self::ClassDeclaration
243                | Self::InterfaceDeclaration
244                | Self::FunctionDeclaration
245                | Self::VariableDeclaration
246                | Self::ImportStatement
247                | Self::PackageDeclaration
248                | Self::NamespaceDeclaration
249                | Self::Assignment
250                | Self::FunctionCall
251                | Self::MethodCall
252                | Self::PropertyAccess
253                | Self::ArrayAccess
254                | Self::ConditionalExpression
255                | Self::BinaryExpression
256                | Self::UnaryExpression
257                | Self::IfStatement
258                | Self::ForStatement
259                | Self::WhileStatement
260                | Self::DoWhileStatement
261                | Self::SwitchStatement
262                | Self::TryStatement
263                | Self::ThrowStatement
264                | Self::ReturnStatement
265                | Self::BreakStatement
266                | Self::ContinueStatement
267        )
268    }
269}
270
271pub type ActionScriptToken = oak_core::Token<ActionScriptSyntaxKind>;