pub struct StringAlgebra { /* private fields */ }Expand description
Binary string algebra over token symbols.
Values are token-symbol vectors. The reserved concat operation appends two vectors; every other nullary symbol evaluates to the one-token string containing that symbol.
Implementations§
Source§impl StringAlgebra
impl StringAlgebra
Sourcepub fn with_signature(signature: Signature) -> Self
pub fn with_signature(signature: Signature) -> Self
Create a string algebra from an existing operation signature.
Sourcepub fn concat_symbol(&self) -> Symbol
pub fn concat_symbol(&self) -> Symbol
Return the concat operation symbol.
Sourcepub fn intern_word(&mut self, word: impl Into<String>) -> Symbol
pub fn intern_word(&mut self, word: impl Into<String>) -> Symbol
Intern a token symbol.
Sourcepub fn parse_string(&mut self, input: &str) -> Vec<Symbol>
pub fn parse_string(&mut self, input: &str) -> Vec<Symbol>
Parse a whitespace-separated string into token symbols.
Sourcepub fn decompose(&self, sentence: Vec<Symbol>) -> StringDecompositionAutomaton
pub fn decompose(&self, sentence: Vec<Symbol>) -> StringDecompositionAutomaton
Build the optimized lazy decomposition automaton for sentence.
Trait Implementations§
Source§impl Algebra for StringAlgebra
impl Algebra for StringAlgebra
Source§type InternalValue = Vec<Symbol>
type InternalValue = Vec<Symbol>
Efficient internal value domain used by
evaluate and decomposition.Source§type ParseError = Infallible
type ParseError = Infallible
Error returned when parsing a textual object representation.
Source§fn evaluate(
&self,
symbol: Symbol,
children: &[Self::InternalValue],
) -> Option<Self::InternalValue>
fn evaluate( &self, symbol: Symbol, children: &[Self::InternalValue], ) -> Option<Self::InternalValue>
Evaluate an operation over child internal values. Read more
Source§fn parse_object(
&mut self,
input: &str,
) -> Result<Self::InternalValue, Self::ParseError>
fn parse_object( &mut self, input: &str, ) -> Result<Self::InternalValue, Self::ParseError>
Parse a textual representation into an internal value.
Source§fn to_external(&self, value: &Self::InternalValue) -> Self::Value
fn to_external(&self, value: &Self::InternalValue) -> Self::Value
Map an internal value to its standalone public form.
Source§fn visualize(&self, value: &Self::Value) -> VisualRepresentation
fn visualize(&self, value: &Self::Value) -> VisualRepresentation
Convert a public value into this algebra’s preferred GUI-neutral representation.
Source§fn evaluate_term_internal(
&self,
arena: &TreeArena<Symbol>,
root: Tree,
) -> Option<Self::InternalValue>
fn evaluate_term_internal( &self, arena: &TreeArena<Symbol>, root: Tree, ) -> Option<Self::InternalValue>
Source§fn evaluate_term(
&self,
arena: &TreeArena<Symbol>,
root: Tree,
) -> Option<Self::Value>
fn evaluate_term( &self, arena: &TreeArena<Symbol>, root: Tree, ) -> Option<Self::Value>
Evaluate a term tree to its public value (bottom-up
evaluate, then
to_external).Source§fn is_valid_value(&self, _value: &Self::InternalValue) -> bool
fn is_valid_value(&self, _value: &Self::InternalValue) -> bool
Return whether
value is a valid internal value.Source§fn decompose_default(
&self,
value: Self::InternalValue,
) -> EvaluatingDecompositionAutomaton<'_, Self>where
Self: Sized,
fn decompose_default(
&self,
value: Self::InternalValue,
) -> EvaluatingDecompositionAutomaton<'_, Self>where
Self: Sized,
Build the default evaluating decomposition automaton for
value.Source§impl Clone for StringAlgebra
impl Clone for StringAlgebra
Source§fn clone(&self) -> StringAlgebra
fn clone(&self) -> StringAlgebra
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StringAlgebra
impl Debug for StringAlgebra
Auto Trait Implementations§
impl Freeze for StringAlgebra
impl RefUnwindSafe for StringAlgebra
impl Send for StringAlgebra
impl Sync for StringAlgebra
impl Unpin for StringAlgebra
impl UnsafeUnpin for StringAlgebra
impl UnwindSafe for StringAlgebra
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