Struct sqruff_lib::core::parser::lexer::RegexLexer
source · pub struct RegexLexer<SegmentArgs: 'static + Clone> { /* private fields */ }
Expand description
This RegexLexer matches based on regular expressions.
Implementations§
source§impl<SegmentArgs: Clone + Debug> RegexLexer<SegmentArgs>
impl<SegmentArgs: Clone + Debug> RegexLexer<SegmentArgs>
pub fn new( name: &'static str, regex: &str, segment_constructor: SegmentConstructorFn<SegmentArgs>, segment_args: SegmentArgs, sub_divider: Option<Box<dyn Matcher>>, trim_post_subdivide: Option<Box<dyn Matcher>> ) -> Result<Self, Error>
sourcepub fn _match(&self, forward_string: &str) -> Option<LexedElement>
pub fn _match(&self, forward_string: &str) -> Option<LexedElement>
Use regexes to match chunks.
Trait Implementations§
source§impl<SegmentArgs: Clone + 'static + Clone> Clone for RegexLexer<SegmentArgs>
impl<SegmentArgs: Clone + 'static + Clone> Clone for RegexLexer<SegmentArgs>
source§fn clone(&self) -> RegexLexer<SegmentArgs>
fn clone(&self) -> RegexLexer<SegmentArgs>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<SegmentArgs: Clone + Debug> Matcher for RegexLexer<SegmentArgs>
impl<SegmentArgs: Clone + Debug> Matcher for RegexLexer<SegmentArgs>
source§fn 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.
source§fn 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>>
fn construct_segment( &self, raw: String, pos_marker: PositionMarker ) -> Box<dyn Segment>
fn _subdivide(&self, matched: LexedElement) -> Vec<LexedElement>
source§fn _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.
Auto Trait Implementations§
impl<SegmentArgs> !RefUnwindSafe for RegexLexer<SegmentArgs>
impl<SegmentArgs> !Send for RegexLexer<SegmentArgs>
impl<SegmentArgs> !Sync for RegexLexer<SegmentArgs>
impl<SegmentArgs> Unpin for RegexLexer<SegmentArgs>where
SegmentArgs: Unpin,
impl<SegmentArgs> !UnwindSafe for RegexLexer<SegmentArgs>
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