use oak_core::{ElementType, Parser, UniversalElementRole};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[repr(u8)]
pub enum LLvmElementType {
Root,
Identifier,
Number,
String,
Comment,
Whitespace,
Newline,
Error,
Eof,
LocalVar,
GlobalVar,
Metadata,
Equal,
Comma,
LParen,
RParen,
LBracket,
RBracket,
LBrace,
RBrace,
Star,
Colon,
Keyword,
Item,
Global,
Function,
Parameter,
Block,
Instruction,
}
impl ElementType for LLvmElementType {
type Role = UniversalElementRole;
fn role(&self) -> Self::Role {
match self {
_ => UniversalElementRole::None,
}
}
}
impl From<crate::lexer::token_type::LLvmTokenType> for LLvmElementType {
fn from(token: crate::lexer::token_type::LLvmTokenType) -> Self {
unsafe { std::mem::transmute(token) }
}
}