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(id: usize) -> Self;
fn to_bit(&self) -> Self::Bit;
fn first() -> Self;
fn next(&self) -> Option<Self>;
fn should_extract(&self) -> bool;
fn lexer<'s>(source: &'s str) -> Result<Self::Lexer<'s>, 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(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
Object Safety§
This trait is not object safe.