pub struct CompiledTable { /* private fields */ }Expand description
Owned parse table data produced by CompiledTable::build.
This holds the compressed table arrays, grammar, and conflict info.
Use CompiledTable::table to get a lightweight [ParseTable] for parsing.
Implementations§
Source§impl CompiledTable
impl CompiledTable
Sourcepub fn build(grammar: &Grammar) -> Result<Self, String>
pub fn build(grammar: &Grammar) -> Result<Self, String>
Build parse tables from a grammar.
Returns an error if grammar conversion fails (for example, unknown symbols).
Sourcepub fn table(&self) -> ParseTable<'_>
pub fn table(&self) -> ParseTable<'_>
Get a lightweight [ParseTable] borrowing from this compiled table.
Sourcepub fn has_conflicts(&self) -> bool
pub fn has_conflicts(&self) -> bool
Returns true if the table has conflicts.
Sourcepub fn format_conflicts(&self) -> Vec<String>
pub fn format_conflicts(&self) -> Vec<String>
Format conflicts as human-readable error messages (one string per conflict).
Sourcepub fn symbol_name(&self, id: SymbolId) -> &str
pub fn symbol_name(&self, id: SymbolId) -> &str
Get the name of a symbol by ID.
Sourcepub fn num_symbols(&self) -> u32
pub fn num_symbols(&self) -> u32
Get the total number of symbols.
Sourcepub fn num_terminals(&self) -> u32
pub fn num_terminals(&self) -> u32
Get the number of terminal symbols.
Sourcepub fn num_states(&self) -> usize
pub fn num_states(&self) -> usize
Get the number of parser states.
Trait Implementations§
Source§impl Debug for CompiledTable
impl Debug for CompiledTable
Source§impl ErrorContext for CompiledTable
impl ErrorContext for CompiledTable
Source§fn symbol_name(&self, id: SymbolId) -> &str
fn symbol_name(&self, id: SymbolId) -> &str
Get the name for a symbol ID.
Source§fn 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).
Auto Trait Implementations§
impl Freeze for CompiledTable
impl RefUnwindSafe for CompiledTable
impl Send for CompiledTable
impl Sync for CompiledTable
impl Unpin for CompiledTable
impl UnsafeUnpin for CompiledTable
impl UnwindSafe for CompiledTable
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