impl_token_trait

Macro impl_token_trait 

Source
macro_rules! impl_token_trait {
    ($token_type:ident; $trait_name:ident;
        $(
            $name:ident  // Name of the token type
        ),+ $(,)? // Supports multiple token types
    ) => { ... };
}
Expand description

Macro to implement specific token types for a given trait. Implements the ‘from’ method for the token type to create a Box from a string.

This macro requires that al token types implement the specified trait and provides a from_str method to parse a string into a token.