Skip to main content

Grammar

Struct Grammar 

Source
pub struct Grammar {
    pub points: Vec<GrammarPoint>,
    pub by_name: HashMap<String, usize, FxBuildHasher>,
    pub string_cache: HashMap<String, u32, FxBuildHasher>,
    pub string_cache_inv: Vec<Rc<String>>,
    /* private fields */
}
Expand description

Produced by bnf_to_grammar.

Next step: tokenize.

Fields§

§points: Vec<GrammarPoint>

Arena for all grammar points in the grammar.

§by_name: HashMap<String, usize, FxBuildHasher>

Lookup table for grammar point IDs (indexes in the arena) by their name.

§string_cache: HashMap<String, u32, FxBuildHasher>

String interning cache: from string to interned ID.

§string_cache_inv: Vec<Rc<String>>

Inverse string interning cache. Index = string ID. The given Rc<String> is the canonical object for that interned string.

Trait Implementations§

Source§

impl Default for Grammar

Source§

fn default() -> Grammar

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Grammar

§

impl !RefUnwindSafe for Grammar

§

impl !Send for Grammar

§

impl !Sync for Grammar

§

impl Unpin for Grammar

§

impl !UnwindSafe for Grammar

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.