ParserTokenID

Trait ParserTokenID 

Source
pub trait ParserTokenID:
    Copy
    + Debug
    + Eq
    + Into<usize> {
    const COUNT_NONTERMINALS: usize;
    const COUNT_TERMINALS: usize;
    const COUNT: usize;

    // Required method
    fn label(&self) -> &'static str;
}
Expand description

A trait representing an identifier for a terminal or nonterminal token in the grammar.

Token IDs represent both grammar terminals and nonterminals used by the parser. The type implementing this trait is typically generated by parlex-gen’s parser generator ASLR.

Required Associated Constants§

Source

const COUNT_NONTERMINALS: usize

The number of nonterminal symbols in the grammar.

Source

const COUNT_TERMINALS: usize

The number of terminal symbols in the grammar.

Source

const COUNT: usize

The total number of tokens: terminals + nonterminals + 1 (error).

Required Methods§

Source

fn label(&self) -> &'static str

Returns the label (name) of this token.

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.

Implementors§