pub struct ParseState { /* private fields */ }
Expand description
Parsing state.
Maintains the current state of parsing, including the trie of items and the chart.
Implementations§
Source§impl ParseState
impl ParseState
Sourcepub fn process<F, G>(
&mut self,
agenda: &mut Vec<ActiveItem>,
literal_callback: F,
token_callback: G,
)
pub fn process<F, G>( &mut self, agenda: &mut Vec<ActiveItem>, literal_callback: F, token_callback: G, )
Processes items with callbacks.
Advances the parsing agenda using provided callbacks for literals and tokens.
§Arguments
agenda
- Mutable vector of active items.literal_callback
- Callback for literals.token_callback
- Callback for tokens.
Sourcepub fn new(concrete: GFConcrete, start_cat: String) -> Self
pub fn new(concrete: GFConcrete, start_cat: String) -> Self
Creates a new parse state.
Initializes the parse state with starting active items based on the start category.
§Arguments
concrete
- The concrete grammar.start_cat
- The start category. There are five inference rules: Pre-Predict, Pre-Combine, Mark-Predict, Mark-Combine and Convert.
Sourcepub fn complete(&self, current_token: &str) -> CompletionAccumulator
pub fn complete(&self, current_token: &str) -> CompletionAccumulator
Sourcepub fn extract_trees(&self) -> Vec<Fun>
pub fn extract_trees(&self) -> Vec<Fun>
Extracts parsed trees.
Reconstructs abstract trees from the chart after parsing.
§Returns
Vector of unique parsed trees.
Trait Implementations§
Source§impl Clone for ParseState
impl Clone for ParseState
Source§fn clone(&self) -> ParseState
fn clone(&self) -> ParseState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for ParseState
impl RefUnwindSafe for ParseState
impl Send for ParseState
impl Sync for ParseState
impl Unpin for ParseState
impl UnwindSafe for ParseState
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