Trait logos::Logos

source ·
pub trait Logos: Sized {
    type Extras: Extras;

    const SIZE: usize;
    const ERROR: Self;

    fn lexicon<S: Source>() -> Lexicon<Self, S>;
}
Expand description

Trait that will be derived for the appropriate enum representing all the tokens

Required Associated Types

Associated Extras for the particular lexer. Those can handle things that aren’t necessarily tokens, such as comments or Automatic Semicolon Insertion in JavaScript.

Required Associated Constants

SIZE is simply a number of possible variants of the Logos enum. The derive macro will make sure that all variants don’t hold values larger or equal to SIZE.

This can be extremely useful for creating Logos Lookup Tables.

Helper const pointing to the error Logos variant.

Required Methods

Implementors