pub trait Lexicon:
Debug
+ Clone
+ Copy
+ PartialEq
+ Eq
+ Hash
+ 'static {
type Bit: Unsigned + Integer + BitAnd<Output = Self::Bit> + BitOr<Output = Self::Bit> + Not<Output = Self::Bit> + Copy;
type Lexer<'s>: Lexer<'s, L = Self>;
type Map<T: Default + Clone>: Default + Clone + Borrow<[T]> + BorrowMut<[T]>;
// Required methods
fn id(&self) -> usize;
fn from_id_unchecked(id: usize) -> Self;
fn to_bit(&self) -> Self::Bit;
fn first() -> Self;
fn next(&self) -> Option<Self>;
fn should_extract(&self) -> bool;
fn lexer(source: &str) -> Result<Self::Lexer<'_>, GrammarError>;
}Expand description
Trait for defining the token types of a grammar
See module-level documentation for more information
Required Associated Types§
Required Methods§
fn from_id_unchecked(id: usize) -> Self
Sourcefn should_extract(&self) -> bool
fn should_extract(&self) -> bool
Whether this token should be excluded from AST, but still has value.
One example is comments
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.