pub struct TerminalToken<'t, AT: Default> {
    pub sym: &'t str,
    pub value: AT,
    pub line: usize,
    pub column: usize,
}
Expand description

This the token type required by Rustlr while parsing. A TerminalToken must correspond to a terminal symbol of the grammar being parsed. The sym field of the struct must correspond to the name of the terminal as defined by the grammar and the value must be of type AT, which the is abstract syntax type (absyntype) of the grammar. It also includes the starting line and column positions of the token. These tokens are generated by implementing Tokenizer::nextsym.

This struct is intended to replace Lextoken, and does not use owned strings. Currently this structure lives side-by side with Lextoken for compatibility.

Fields

sym: &'t strvalue: ATline: usizecolumn: usize

Implementations

creates new lexical token with sym s, value v, line ln and column cl

transfers lexical information (line/column) to new TerminalToken

transfers lexical information from a (RawToken,line,column) triple returned by StrTokenizer::next_token to a new TerminalToken with sym s and value v.

creates an LBox vale using lexical information contained in the token.

creates a LBox<dyn Any>, which allows attributes of different types to be associated with grammar symbols.

similar to crate::ZCParser::lb, but creates a LRc instead of LBox

similar to crate::ZCParser::lba but creates a LRc

creates a TerminalToken from a RawToken with value of type LBox<dyn Any>

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.