[][src]Struct cfgrammar::yacc::follows::YaccFollows

pub struct YaccFollows<StorageT> { /* fields omitted */ }

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

impl<StorageT: 'static + PrimInt + Unsigned> YaccFollows<StorageT> where
    usize: AsPrimitive<StorageT>, 
[src]

pub fn new(grm: &YaccGrammar<StorageT>) -> Self[src]

Generates and returns the Follows set for the given grammar.

pub fn follows(&self, ridx: RIdx<StorageT>) -> &Vob[src]

Return the Follows Vob for rule ridx.

pub fn is_set(&self, ridx: RIdx<StorageT>, tidx: TIdx<StorageT>) -> bool[src]

Returns true if the token tidx is in the follow set for rule ridx.

Trait Implementations

impl<StorageT: Debug> Debug for YaccFollows<StorageT>[src]

Auto Trait Implementations

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.