pub enum Error { ExceededDepthRange, } #[derive(PartialEq)] pub enum TokenKind<'t> { Normal, Comment, String, Number, Operator, Symbol, Literal, Function, Keyword, KeywordAlt, Custom(&'t str) } impl <'t> Into<&'t str> for TokenKind<'t> { fn into(self) -> &'t str { match self { TokenKind::Normal => "normal", TokenKind::Comment => "comment", TokenKind::String => "string", TokenKind::Number => "number", TokenKind::Operator => "operator", TokenKind::Symbol => "symbol", TokenKind::Literal => "literal", TokenKind::Function => "function", TokenKind::Keyword => "keyword", TokenKind::KeywordAlt => "keyword2", TokenKind::Custom(custom_kind) => custom_kind } } } pub struct Token<'t> { pub token_type: TokenKind<'t>, pub value: String }