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 num_symbols(&self) -> usize
pub fn add_rule_ext( &mut self, lhs: SymIdx, condition: ParamCond, rhs: Vec<(SymIdx, ParamExpr)>, ) -> Result<(), Error>
pub fn add_rule(&mut self, lhs: SymIdx, rhs: Vec<SymIdx>) -> Result<(), Error>
pub fn link_gen_grammar( &mut self, lhs: SymIdx, grammar: SymIdx, ) -> Result<(), Error>
pub fn check_empty_symbol_parametric_ok(&self, sym: SymIdx) -> Result<(), Error>
pub fn check_empty_symbol(&self, sym: SymIdx) -> Result<(), Error>
pub fn make_parametric(&mut self, lhs: SymIdx) -> Result<(), Error>
pub fn make_terminal( &mut self, lhs: SymIdx, lex: LexemeIdx, lexer_spec: &LexerSpec, ) -> Result<(), Error>
pub fn set_temperature(&mut self, lhs: SymIdx, temp: f32)
pub fn make_gen_grammar( &mut self, lhs: SymIdx, data: GenGrammarOptions, ) -> Result<(), Error>
pub fn apply_node_props(&mut self, lhs: SymIdx, props: NodeProps)
pub fn sym_props_mut(&mut self, sym: SymIdx) -> &mut SymbolProps
pub fn sym_props(&self, sym: SymIdx) -> &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, limits: &ParserLimits, ) -> Result<CGrammar, Error>
pub fn resolve_grammar_refs( &mut self, lexer_spec: &mut LexerSpec, ctx: &HashMap<GrammarId, (SymIdx, LexemeClass)>, ) -> Result<(), Error>
pub fn fresh_symbol_ext(&mut self, name0: &str, symprops: SymbolProps) -> SymIdx
pub fn stats(&self) -> String
pub fn to_string(&self, lexer_spec: Option<&LexerSpec>) -> String
pub fn rename_symbol(&mut self, idx: SymIdx, name: &str)
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.