Struct cfgrammar::yacc::firsts::YaccFirsts[][src]

pub struct YaccFirsts<StorageT> { /* fields omitted */ }
Expand description

Firsts stores all the first 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 firsts = Firsts::new(&grm);

then the following assertions (and only the following assertions) about the firsts set are correct:

  assert!(firsts.is_set(grm.rule_idx("S").unwrap(), grm.token_idx("a").unwrap()));
  assert!(firsts.is_set(grm.rule_idx("S").unwrap(), grm.token_idx("b").unwrap()));
  assert!(firsts.is_set(grm.rule_idx("A").unwrap(), grm.token_idx("a").unwrap()));
  assert!(firsts.is_epsilon_set(grm.rule_idx("A").unwrap()));

Implementations

Generates and returns the firsts set for the given grammar.

Return all the firsts for rule ridx.

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

Returns true if the rule ridx has epsilon in its first set.

Ensures that the firsts bit for token tidx rule ridx is set. Returns true if it was already set, or false otherwise.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.