pub trait Matcher: Debug + DynClone + CloneMatcher + 'static {
// Required methods
fn get_name(&self) -> String;
fn match_(&self, forward_string: String) -> Result<LexMatch, ValueError>;
fn search(&self, forward_string: &str) -> Option<Range<usize>>;
fn get_sub_divider(&self) -> Option<Box<dyn Matcher>>;
fn get_trim_post_subdivide(&self) -> Option<Box<dyn Matcher>>;
// Provided methods
fn _subdivide(&self, matched: LexedElement) -> Vec<LexedElement> { ... }
fn _trim_match(&self, matched_str: &str) -> Vec<LexedElement> { ... }
fn construct_segment(
&self,
_raw: String,
_pos_marker: PositionMarker
) -> Box<dyn Segment> { ... }
}
Required Methods§
sourcefn match_(&self, forward_string: String) -> Result<LexMatch, ValueError>
fn match_(&self, forward_string: String) -> Result<LexMatch, ValueError>
Given a string, match what we can and return the rest.
sourcefn get_sub_divider(&self) -> Option<Box<dyn Matcher>>
fn get_sub_divider(&self) -> Option<Box<dyn Matcher>>
Access methods that need to be implemented by the subclass. Get the sub-divider for this matcher.
fn get_trim_post_subdivide(&self) -> Option<Box<dyn Matcher>>
Provided Methods§
fn _subdivide(&self, matched: LexedElement) -> Vec<LexedElement>
sourcefn _trim_match(&self, matched_str: &str) -> Vec<LexedElement>
fn _trim_match(&self, matched_str: &str) -> Vec<LexedElement>
Given a string, trim if we are allowed to.