pub enum UniversalTokenRole {
Keyword,
Name,
Literal,
Escape,
Operator,
Punctuation,
Comment,
Whitespace,
Error,
None,
Eof,
}Expand description
Represents the general syntactic role of a token across diverse languages.
By mapping to these roles, generic tools can identify names, literals, or operators across 100+ languages without needing to learn the specifics of each grammar.
Variants§
Keyword
Language reserved words or built-in commands (e.g., ‘SELECT’, ‘let’, ‘MOV’).
Name
Identifiers, labels, keys, tags, or any name-like token.
Literal
Literal values like strings, numbers, booleans, or nulls.
Escape
An escape sequence or a special character representation within a literal.
Operator
Mathematical, logical, or structural operators (e.g., ‘+’, ‘=>’, ‘LIKE’).
Punctuation
Structural characters like brackets, commas, semicolons.
Comment
Developer annotations or documentation.
Whitespace
Formatting characters like spaces or tabs.
Error
Malformed or unrecognized content.
None
No specific role assigned.
Eof
End of stream marker.
Trait Implementations§
Source§impl Clone for UniversalTokenRole
impl Clone for UniversalTokenRole
Source§fn clone(&self) -> UniversalTokenRole
fn clone(&self) -> UniversalTokenRole
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for UniversalTokenRole
Source§impl Debug for UniversalTokenRole
impl Debug for UniversalTokenRole
Source§impl<'de> Deserialize<'de> for UniversalTokenRole
impl<'de> Deserialize<'de> for UniversalTokenRole
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for UniversalTokenRole
Source§impl Hash for UniversalTokenRole
impl Hash for UniversalTokenRole
Source§impl PartialEq for UniversalTokenRole
impl PartialEq for UniversalTokenRole
Source§fn eq(&self, other: &UniversalTokenRole) -> bool
fn eq(&self, other: &UniversalTokenRole) -> bool
self and other values to be equal, and is used by ==.