use oak_core::{ElementType, Parser, UniversalElementRole};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[repr(u16)]
pub enum LuaElementType {
Root,
And,
Break,
Do,
Else,
Elseif,
End,
False,
For,
Function,
Goto,
If,
In,
Local,
Nil,
Not,
Or,
Repeat,
Return,
Then,
True,
Until,
While,
Identifier,
Number,
String,
Plus,
Minus,
Star,
Slash,
Percent,
Caret,
Hash,
Ampersand,
Tilde,
Pipe,
LtLt,
GtGt,
SlashSlash,
EqEq,
TildeEq,
LtEq,
GtEq,
Lt,
Gt,
Eq,
LeftParen,
RightParen,
LeftBrace,
RightBrace,
LeftBracket,
RightBracket,
ColonColon,
Semicolon,
Colon,
Comma,
Dot,
DotDot,
DotDotDot,
Whitespace,
Newline,
Comment,
EndOfStream,
Error,
SourceFile,
FunctionDeclaration,
ParameterList,
Parameter,
BlockStatement,
LocalStatement,
AssignmentStatement,
ExpressionStatement,
IfStatement,
WhileStatement,
ForStatement,
RepeatStatement,
DoStatement,
BreakStatement,
ReturnStatement,
GotoStatement,
LabelStatement,
IdentifierExpression,
LiteralExpression,
BooleanLiteral,
NilLiteral,
ParenthesizedExpression,
BinaryExpression,
UnaryExpression,
CallExpression,
MemberExpression,
IndexExpression,
TableConstructorExpression,
FunctionExpression,
VarargExpression,
TableField,
Field,
FieldList,
ArgumentList,
VariableList,
ExpressionList,
NameList,
FunctionName,
FunctionBody,
ChunkStatement,
StatementList,
}
impl ElementType for LuaElementType {
type Role = UniversalElementRole;
fn role(&self) -> Self::Role {
match self {
_ => UniversalElementRole::None,
}
}
}
impl From<crate::lexer::token_type::LuaTokenType> for LuaElementType {
fn from(token: crate::lexer::token_type::LuaTokenType) -> Self {
unsafe { std::mem::transmute(token) }
}
}