Struct ParseContext

Source
pub struct ParseContext<'src, 'cx, Cx: CxType> { /* private fields */ }

Implementations§

Source§

impl<'src, const LA: usize> ParseContext<'src, 'static, CxTypeImpl<LA>>

Source

pub fn new_with<R>( src: &'src str, f: impl FnOnce(ParseContext<'src, '_, CxTypeImpl<LA>>) -> R, ) -> (R, ParseError<'src>)

Source§

impl<'src, 'cx, Cx: CxType> ParseContext<'src, 'cx, Cx>

Source

pub fn by_ref<'this>(&'this mut self) -> ParseContext<'src, 'this, Cx>

Source

pub fn should_discard(&self) -> bool

Source

pub fn prefer_continue(&self) -> bool

Source

pub fn update<'src2, 'cx2>( self, update: ParseContextUpdate<'src2, 'cx2, Cx>, ) -> ParseContext<'src2, 'cx2, Cx>
where 'src: 'src2, 'cx: 'cx2,

Source

pub fn discarding(self) -> Self

Source

pub fn expecting(self, expected_parse: impl Into<Option<ExpectedParse>>) -> Self

Source

pub fn src(&self) -> &'src str

Source

pub fn error_mut(&mut self) -> &mut ParseError<'static>

Source

pub fn location(&self) -> Location

Source

pub fn set_location(&mut self, location: Location)

Source

pub fn advance(&mut self)

Source

pub fn look_ahead(&self) -> &TokenBuf<Cx::LookAhead>

Source

pub fn look_ahead_mut(&mut self) -> &mut TokenBuf<Cx::LookAhead>

Source

pub fn into_parts(self) -> ParseContextParts<'src, 'cx>

Source

pub fn as_parts(&mut self) -> ParseContextParts<'src, '_>

Source

pub fn pre_parse<'next, T: Rule>( &mut self, next: impl Into<Option<&'next RuleObject<'next, Cx>>> + 'next, ) -> RuleParseResult<()>
where Cx: 'next,

Source

pub fn record_error<'next, T: Rule>( &mut self, next: impl Into<Option<&'next RuleObject<'next, Cx>>> + 'next, ) -> RuleParseResult<()>
where Cx: 'next,

Source

pub fn error_at(&mut self, location: Location)

Trait Implementations§

Source§

impl<'src, 'cx, Cx: Debug + CxType> Debug for ParseContext<'src, 'cx, Cx>
where Cx::LookAhead: Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'src, 'cx, Cx> Freeze for ParseContext<'src, 'cx, Cx>
where Cx: Freeze,

§

impl<'src, 'cx, Cx> RefUnwindSafe for ParseContext<'src, 'cx, Cx>
where Cx: RefUnwindSafe, <Cx as ContextType>::LookAhead: RefUnwindSafe,

§

impl<'src, 'cx, Cx> Send for ParseContext<'src, 'cx, Cx>
where Cx: Send + Sync, <Cx as ContextType>::LookAhead: Send,

§

impl<'src, 'cx, Cx> Sync for ParseContext<'src, 'cx, Cx>
where Cx: Sync, <Cx as ContextType>::LookAhead: Sync,

§

impl<'src, 'cx, Cx> Unpin for ParseContext<'src, 'cx, Cx>
where Cx: Unpin,

§

impl<'src, 'cx, Cx> !UnwindSafe for ParseContext<'src, 'cx, Cx>

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