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 + Sync> RegexLexer<SegmentArgs>
impl<SegmentArgs: Clone + Debug + Sync> 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 + Sync> Matcher for RegexLexer<SegmentArgs>
impl<SegmentArgs: Clone + Debug + Sync> Matcher for RegexLexer<SegmentArgs>
source§fn match_(&self, forward_string: &str) -> Result<LexMatch, ValueError>
fn match_(&self, forward_string: &str) -> 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: SmolStr, pos_marker: PositionMarker ) -> ErasedSegment
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> Freeze for RegexLexer<SegmentArgs>where
SegmentArgs: Freeze,
impl<SegmentArgs> !RefUnwindSafe for RegexLexer<SegmentArgs>
impl<SegmentArgs> !Send for RegexLexer<SegmentArgs>
impl<SegmentArgs> Sync for RegexLexer<SegmentArgs>where
SegmentArgs: Sync,
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
source§impl<T> CloneMatcher for T
impl<T> CloneMatcher for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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