pub trait ErrorContext {
// Required methods
fn symbol_name(&self, id: SymbolId) -> &str;
fn state_symbol(&self, state: usize) -> SymbolId;
fn state_items(&self, state: usize) -> &[(u16, u8)];
fn rule_rhs(&self, rule: usize) -> &[u32];
}Expand description
Trait for providing error context (symbol names, state/rule info).
Implemented by CompiledTable, ErrorInfo,
and the generated parser’s error_info() static.
Required Methods§
Sourcefn symbol_name(&self, id: SymbolId) -> &str
fn symbol_name(&self, id: SymbolId) -> &str
Get the name for a symbol ID.
Sourcefn state_symbol(&self, state: usize) -> SymbolId
fn state_symbol(&self, state: usize) -> SymbolId
Get the accessing symbol for a state (the symbol shifted/reduced to enter it).
Sourcefn state_items(&self, state: usize) -> &[(u16, u8)]
fn state_items(&self, state: usize) -> &[(u16, u8)]
Get active LR items for a state. Each pair is (rule_index, dot_position):
the dot position is how far into the rule’s RHS the parser has progressed.