use crate::lexer::CssTokenType;
use oak_core::{ElementType, UniversalElementRole};
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum CssElementType {
SourceFile,
RuleSet,
SelectorList,
Selector,
DeclarationBlock,
Declaration,
Property,
Value,
AtRule,
MediaQuery,
Function,
Url,
CalcExpression,
}
impl ElementType for CssElementType {
type Role = UniversalElementRole;
fn role(&self) -> Self::Role {
match self {
Self::SourceFile => UniversalElementRole::Root,
Self::RuleSet => UniversalElementRole::Container,
Self::SelectorList => UniversalElementRole::Detail,
Self::DeclarationBlock => UniversalElementRole::Container,
Self::Declaration => UniversalElementRole::Statement,
_ => UniversalElementRole::None,
}
}
}
impl From<CssTokenType> for CssElementType {
fn from(token: CssTokenType) -> Self {
match token {
_ => Self::SourceFile, }
}
}