Struct sqruff_lib::core::parser::lexer::StringLexer

source ·
pub struct StringLexer<SegmentArgs: 'static + Clone> { /* private fields */ }
Expand description

This singleton matcher matches strings exactly. This is the simplest usable matcher, but it also defines some of the mechanisms for more complicated matchers, which may simply override the _match function rather than the public match function. This acts as the base class for matchers.

Implementations§

source§

impl<SegmentArgs: Clone + Debug + Sync> StringLexer<SegmentArgs>

source

pub fn new( name: &'static str, template: &'static str, segment_constructor: SegmentConstructorFn<SegmentArgs>, segment_args: SegmentArgs, sub_divider: Option<Box<dyn Matcher>>, trim_post_subdivide: Option<Box<dyn Matcher>> ) -> Self

Trait Implementations§

source§

impl<SegmentArgs: Clone + 'static + Clone> Clone for StringLexer<SegmentArgs>

source§

fn clone(&self) -> StringLexer<SegmentArgs>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<SegmentArgs: Debug + Clone> Debug for StringLexer<SegmentArgs>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<SegmentArgs: Clone + Debug> Display for StringLexer<SegmentArgs>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<SegmentArgs: Clone + Debug + Sync> Matcher for StringLexer<SegmentArgs>

source§

fn match_(&self, forward_string: &str) -> Result<LexMatch, ValueError>

Given a string, match what we can and return the rest.

source§

fn get_name(&self) -> String

The name of the matcher.
source§

fn search(&self, forward_string: &str) -> Option<Range<usize>>

Use regex to find a substring.
source§

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.
source§

fn get_trim_post_subdivide(&self) -> Option<Box<dyn Matcher>>

source§

fn construct_segment( &self, raw: String, pos_marker: PositionMarker ) -> ErasedSegment

source§

fn _subdivide(&self, matched: LexedElement) -> Vec<LexedElement>

source§

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 StringLexer<SegmentArgs>
where SegmentArgs: Freeze,

§

impl<SegmentArgs> !RefUnwindSafe for StringLexer<SegmentArgs>

§

impl<SegmentArgs> !Send for StringLexer<SegmentArgs>

§

impl<SegmentArgs> Sync for StringLexer<SegmentArgs>
where SegmentArgs: Sync,

§

impl<SegmentArgs> Unpin for StringLexer<SegmentArgs>
where SegmentArgs: Unpin,

§

impl<SegmentArgs> !UnwindSafe for StringLexer<SegmentArgs>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneMatcher for T
where T: Matcher + DynClone,

source§

fn clone_box(&self) -> Box<dyn Matcher>

source§

impl<T> Config for T

source§

fn config(self, f: impl FnOnce(&mut Self)) -> Self

source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> Any for T
where T: Any,

source§

impl<T> CloneAny for T
where T: Any + Clone,