ParserProdID

Trait ParserProdID 

Source
pub trait ParserProdID:
    Copy
    + Debug
    + Eq
    + Into<usize> {
    type TokenID: ParserTokenID;

    const COUNT: usize;

    // Required methods
    fn label(&self) -> &'static str;
    fn lhs_token_id(&self) -> Self::TokenID;
    fn size(&self) -> usize;
}
Expand description

A trait representing an identifier for a grammar production rule.

A production defines how tokens and nonterminals combine to form higher-level syntactic constructs. The type implementing this trait is typically generated by parlex-gen’s parser generator ASLR.

Required Associated Constants§

Source

const COUNT: usize

The total number of production rules.

Required Associated Types§

Source

type TokenID: ParserTokenID

The associated token identifier type.

Required Methods§

Source

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

Returns the label (name) of this production.

Source

fn lhs_token_id(&self) -> Self::TokenID

Returns the token ID of the left-hand side (LHS) nonterminal.

Source

fn size(&self) -> usize

Returns the number of symbols on the right-hand side (RHS) of the production.

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§