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