pub struct Item {
pub production: ProdIdx,
pub index: u16,
/* private fields */
}
Expand description
Item in a State
.
This represent one of the things the parser may be currently parsing.
Fields§
§production: ProdIdx
The production of this item.
This has the form lhs → rhs
, where rhs
may be retrieved using
Grammar::get_rhs
.
index: u16
At which point of production
we are.
Implementations§
source§impl Item
impl Item
sourcepub fn has_lookahead(&self, lookahead: Lookahead) -> bool
pub fn has_lookahead(&self, lookahead: Lookahead) -> bool
Returns true
if lookahead
may be found right after self
.
sourcepub fn get_all_lookaheads(&self) -> impl Iterator<Item = Lookahead> + '_
pub fn get_all_lookaheads(&self) -> impl Iterator<Item = Lookahead> + '_
Returns all lookaheads that may be found right after self
.
sourcepub fn current_symbol(&self, grammar: &Grammar) -> Option<Symbol>
pub fn current_symbol(&self, grammar: &Grammar) -> Option<Symbol>
Uses grammar
to get the production corresponding to self
, at read the
symbol at Self::index
.
If index
is at the last position, this will return None
.
Trait Implementations§
source§impl PartialEq<Item> for Item
impl PartialEq<Item> for Item
impl Eq for Item
impl StructuralEq for Item
impl StructuralPartialEq for Item
Auto Trait Implementations§
impl RefUnwindSafe for Item
impl Send for Item
impl Sync for Item
impl Unpin for Item
impl UnwindSafe for Item
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