Struct cfgrammar::yacc::follows::YaccFollows
source · pub struct YaccFollows<StorageT> { /* private fields */ }
Expand description
Follows
stores all the Follow sets for a given grammar. For example, given this code and
grammar:
let grm = YaccGrammar::new(YaccKind::Original(YaccOriginalActionKind::GenericParseTree), "
S: A 'b';
A: 'a' | ;
").unwrap();
let follows = Follows::new(&grm);
then the following assertions (and only the following assertions) about the Follows set are correct:
assert!(follows.is_set(grm.rule_idx("S").unwrap(), grm.eof_token_idx());
assert!(follows.is_set(grm.rule_idx("A").unwrap(), grm.token_idx("b").unwrap()));
Implementations§
source§impl<StorageT: 'static + PrimInt + Unsigned> YaccFollows<StorageT>where
usize: AsPrimitive<StorageT>,
impl<StorageT: 'static + PrimInt + Unsigned> YaccFollows<StorageT>where
usize: AsPrimitive<StorageT>,
sourcepub fn new(grm: &YaccGrammar<StorageT>) -> Self
pub fn new(grm: &YaccGrammar<StorageT>) -> Self
Generates and returns the Follows set for the given grammar.
Trait Implementations§
Auto Trait Implementations§
impl<StorageT> Freeze for YaccFollows<StorageT>
impl<StorageT> RefUnwindSafe for YaccFollows<StorageT>where
StorageT: RefUnwindSafe,
impl<StorageT> Send for YaccFollows<StorageT>where
StorageT: Send,
impl<StorageT> Sync for YaccFollows<StorageT>where
StorageT: Sync,
impl<StorageT> Unpin for YaccFollows<StorageT>where
StorageT: Unpin,
impl<StorageT> UnwindSafe for YaccFollows<StorageT>where
StorageT: UnwindSafe,
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