Struct Grammar
pub struct Grammar { /* private fields */ }
Implementations§
§impl Grammar
impl Grammar
pub fn new(name: Option<String>) -> Grammar
pub fn start(&self) -> SymIdx
pub fn is_small(&self) -> bool
pub fn add_rule(&mut self, lhs: SymIdx, rhs: Vec<SymIdx>) -> Result<(), Error>
pub fn make_terminal( &mut self, lhs: SymIdx, lex: LexemeIdx, lexer_spec: &LexerSpec, ) -> Result<(), Error>
pub fn make_gen_grammar( &mut self, lhs: SymIdx, data: GenGrammarOptions, ) -> Result<(), Error>
pub fn sym_props_mut(&mut self, sym: SymIdx) -> &mut SymbolProps
pub fn sym_name(&self, sym: SymIdx) -> &str
pub fn optimize(&self) -> Grammar
pub fn name(&self) -> Option<&str>
pub fn compile(&self, lexer_spec: LexerSpec) -> CGrammar
pub fn resolve_grammar_refs( &mut self, lexer_spec: &mut LexerSpec, ctx: &HashMap<GrammarId, (SymIdx, LexemeClass)>, ) -> Result<(), Error>
pub fn apply_props(&mut self, sym: SymIdx, props: SymbolProps)
pub fn fresh_symbol(&mut self, name0: &str) -> SymIdx
pub fn fresh_symbol_ext(&mut self, name0: &str, symprops: SymbolProps) -> SymIdx
pub fn stats(&self) -> String
Trait Implementations§
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> 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
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Forward to the method defined on the type
Any
.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Forward to the method defined on the type
Any
.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more