pub struct ParserCtx<L, D, U>where
L: Lexer<U>,
D: ParserData,{
pub lexer: L,
pub tokens: Vec<L::Token>,
pub states: Vec<D::StateID>,
pub stats: ParserStats,
}Expand description
Core parser execution context.
ParserCtx manages the entire runtime state of the parser, including its lexer,
parser states, token stack, and statistics. It is responsible for coordinating
parsing operations, maintaining the parser stack, and collecting performance metrics.
§Type Parameters
L: The lexer type, which implements theLexertrait.D: The parser data definition, which implements theParserDatatrait. This type is usually generated by the parlex-gen parser generator (ASLR).U: User-defined data passed to parser and lexer actions.
Fields§
§lexer: LThe lexer instance used to produce tokens.
tokens: Vec<L::Token>The stack of tokens currently held by the parser.
states: Vec<D::StateID>The stack of parser state identifiers.
stats: ParserStatsStatistics collected during parsing.
Implementations§
Source§impl<L, D, U> ParserCtx<L, D, U>where
L: Lexer<U>,
D: ParserData,
Implementation of ParserCtx methods.
impl<L, D, U> ParserCtx<L, D, U>where
L: Lexer<U>,
D: ParserData,
Implementation of ParserCtx methods.
This impl defines the core construction logic for the parser context.
It provides methods to initialize a new parser context instance and set up
the runtime environment for parsing, including token and state stacks
and parser statistics.
§Type Parameters
L: The lexer type implementing theLexertrait.D: The parser data type implementing theParserDatatrait. This type is usually generated by the parlex-gen parser generator (ASLR).U: User-defined data passed to parser and lexer actions.
Auto Trait Implementations§
impl<L, D, U> Freeze for ParserCtx<L, D, U>where
L: Freeze,
impl<L, D, U> RefUnwindSafe for ParserCtx<L, D, U>where
L: RefUnwindSafe,
<L as Lexer<U>>::Token: RefUnwindSafe,
<D as ParserData>::StateID: RefUnwindSafe,
impl<L, D, U> Send for ParserCtx<L, D, U>
impl<L, D, U> Sync for ParserCtx<L, D, U>
impl<L, D, U> Unpin for ParserCtx<L, D, U>
impl<L, D, U> UnwindSafe for ParserCtx<L, D, U>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more