Skip to main content

SpanParser

Struct SpanParser 

Source
pub struct SpanParser<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> SpanParser<'a>

Source

pub fn then_span(self, other: SpanParser<'a>) -> SpanParser<'a>

Sequential composition: flattens nested Seq chains into a single Vec.

Source

pub fn or(self, other: SpanParser<'a>) -> SpanParser<'a>

Alternation: flattens nested OneOf chains into a single Vec.

Source

pub fn opt_span(self) -> SpanParser<'a>

Source

pub fn many_span(self, bounds: impl RangeBounds<usize> + 'a) -> SpanParser<'a>

Source

pub fn sep_by_span( self, sep: SpanParser<'a>, bounds: impl RangeBounds<usize> + 'a, ) -> SpanParser<'a>

Source

pub fn sep_by_ws_span( self, sep: SpanParser<'a>, bounds: impl RangeBounds<usize> + 'a, ) -> SpanParser<'a>

Fused sep_by + whitespace trimming: single trim between each step.

Source

pub fn wrap_span( self, left: SpanParser<'a>, right: SpanParser<'a>, ) -> SpanParser<'a>

Source

pub fn skip_span(self, next: SpanParser<'a>) -> SpanParser<'a>

Source

pub fn next_after(self, next: SpanParser<'a>) -> SpanParser<'a>

Source

pub fn not_span(self, negated: SpanParser<'a>) -> SpanParser<'a>

Source

pub fn minus_span(self, excluded: SpanParser<'a>) -> SpanParser<'a>

Set difference: match self only if excluded would NOT match at the same starting position. Used for EBNF/BNF exception (-) semantics.

Source

pub fn look_ahead_span(self, lookahead: SpanParser<'a>) -> SpanParser<'a>

Source

pub fn negate_span(self) -> SpanParser<'a>

Zero-width negative assertion: succeeds (empty Span) when inner fails.

Source

pub fn peek_span(self) -> SpanParser<'a>

Zero-width positive assertion: succeeds with inner’s Span but does NOT consume input. The dual of negate_span().

Source

pub fn trim_whitespace(self) -> SpanParser<'a>

Source

pub fn save_state(self) -> SpanParser<'a>

Source

pub fn into_parser(self) -> Parser<'a, Span<'a>>

Convert to a generic Parser<'a, Span<'a>>.

Source

pub fn map<O: 'a>(self, f: fn(Span<'a>) -> O) -> Parser<'a, O>

Map Span output to any type, producing a generic Parser.

Source

pub fn map_closure<O: 'a>(self, f: impl Fn(Span<'a>) -> O + 'a) -> Parser<'a, O>

Map with a closure (not just fn pointer).

Source§

impl<'a> SpanParser<'a>

Source

pub fn call(&self, state: &mut ParserState<'a>) -> Option<Span<'a>>

Trait Implementations§

Source§

impl<'a> BitOr for SpanParser<'a>

Source§

type Output = SpanParser<'a>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: SpanParser<'a>) -> Self::Output

Performs the | operation. Read more
Source§

impl<'a> From<SpanParser<'a>> for Parser<'a, Span<'a>>

Source§

fn from(sp: SpanParser<'a>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for SpanParser<'a>

§

impl<'a> !RefUnwindSafe for SpanParser<'a>

§

impl<'a> !Send for SpanParser<'a>

§

impl<'a> !Sync for SpanParser<'a>

§

impl<'a> Unpin for SpanParser<'a>

§

impl<'a> UnsafeUnpin for SpanParser<'a>

§

impl<'a> !UnwindSafe for SpanParser<'a>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.