oak_vlang/parser/
element_type.rs1use crate::lexer::token_type::VLangTokenType;
2use oak_core::{ElementType, UniversalElementRole};
3
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
6#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
7pub enum VLangElementType {
8 SourceFile,
10 Token(VLangTokenType),
12}
13
14impl ElementType for VLangElementType {
15 type Role = UniversalElementRole;
16
17 fn role(&self) -> Self::Role {
18 match self {
19 Self::SourceFile => UniversalElementRole::Root,
20 Self::Token(_) => UniversalElementRole::None,
21 }
22 }
23}
24
25impl From<VLangTokenType> for VLangElementType {
26 fn from(token: VLangTokenType) -> Self {
27 Self::Token(token)
28 }
29}