pub struct Chart {
pub forest: HashMap<FId, Vec<Production>>,
pub next_id: FId,
pub offset: usize,
/* private fields */
}
Expand description
Chart for parsing.
Manages active and passive items during chart parsing.
Fields§
§forest: HashMap<FId, Vec<Production>>
Forest of productions.
next_id: FId
Next ID.
offset: usize
Current offset.
Implementations§
Source§impl Chart
impl Chart
Sourcepub fn new(concrete: GFConcrete) -> Self
pub fn new(concrete: GFConcrete) -> Self
Creates a new chart from concrete.
Initializes the forest with productions from the concrete grammar.
§Arguments
concrete
- The concrete grammar.
Sourcepub fn lookup_aco(
&self,
offset: usize,
fid: FId,
label: i32,
) -> Option<&Vec<ActiveItem>>
pub fn lookup_aco( &self, offset: usize, fid: FId, label: i32, ) -> Option<&Vec<ActiveItem>>
Sourcepub fn shift(&mut self)
pub fn shift(&mut self)
Shifts the chart to next offset.
Moves current active to actives and clears current active and passive.
Sourcepub fn expand_forest(&self, fid: FId) -> Vec<Production>
pub fn expand_forest(&self, fid: FId) -> Vec<Production>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Chart
impl RefUnwindSafe for Chart
impl Send for Chart
impl Sync for Chart
impl Unpin for Chart
impl UnwindSafe for Chart
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