Struct earlgrey::GrammarBuilder
source · [−]pub struct GrammarBuilder { /* private fields */ }
Expand description
Builds a Gramar while validating existence of Symbols and checking rules.
Implementations
sourceimpl GrammarBuilder
impl GrammarBuilder
pub fn nonterm<S>(self, name: S) -> Self where
S: Into<String>,
pub fn terminal<S, P>(self, name: S, pred: P) -> Self where
S: Into<String>,
P: 'static + Fn(&str) -> bool,
pub fn quiet_nonterm<S>(&mut self, name: S) where
S: Into<String>,
pub fn quiet_terminal<S, P>(&mut self, name: S, pred: P) where
S: Into<String>,
P: 'static + Fn(&str) -> bool,
pub fn rule<S, S2>(self, head: S, spec: &[S2]) -> Self where
S: AsRef<str>,
S2: AsRef<str>,
pub fn quiet_rule<S, S2>(&mut self, head: S, spec: &[S2]) where
S: AsRef<str>,
S2: AsRef<str>,
sourcepub fn into_grammar<S>(self, start: S) -> Result<Grammar, String> where
S: Into<String>,
pub fn into_grammar<S>(self, start: S) -> Result<Grammar, String> where
S: Into<String>,
Consume builder into Grammar
sourcepub fn unique_symbol_name(&self) -> String
pub fn unique_symbol_name(&self) -> String
Generate unique name for a Symbol (used to build grammar mechanically)
Trait Implementations
sourceimpl Default for GrammarBuilder
impl Default for GrammarBuilder
sourcefn default() -> GrammarBuilder
fn default() -> GrammarBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl !RefUnwindSafe for GrammarBuilder
impl !Send for GrammarBuilder
impl !Sync for GrammarBuilder
impl Unpin for GrammarBuilder
impl !UnwindSafe for GrammarBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more