Struct BasicParser

Source
pub struct BasicParser<T>
where T: Grinder<Item = Option<u8>, Error = DiagBuilder2>,
{ /* private fields */ }

Implementations§

Source§

impl<T> BasicParser<T>
where T: Grinder<Item = Option<u8>, Error = DiagBuilder2>,

Source

pub fn new(input: Lexer<T>) -> BasicParser<T>

Create a new parser which consumes input from the given lexer.

Trait Implementations§

Source§

impl<T> TokenStream<Token> for BasicParser<T>
where T: Grinder<Item = Option<u8>, Error = DiagBuilder2>,

Source§

fn peek(&mut self, offset: usize) -> Spanned<Token>

Look ahead at a token in the stream.
Source§

fn bump(&mut self)

Consume the current token.
Source§

fn consumed(&self) -> usize

Get the number of tokens consumed. Excludes tokens skipped with skip.
Source§

fn last_span(&self) -> Span

Get the span of the last token consumed token (bumped or skipped).
Source§

fn emit(&mut self, diag: DiagBuilder2)

Emit a diagnostic.
Source§

fn severity(&self) -> Severity

Get the severity of the worst diagnostic emitted so far.
Source§

fn skip(&mut self)

Skip the current token. Usually the same as bump, but may be used to keep skipped tokens out of the consumed tokens count by some parsers.
Source§

fn last_loc(&self) -> Location

Get the tail location of the last consumed token (bumped or skipped).
Source§

fn is_fatal(&self) -> bool

Check whether a fatal diagnostic has been emitted.
Source§

fn is_error(&self) -> bool

Check whether an error diagnostic has been emitted.

Auto Trait Implementations§

§

impl<T> Freeze for BasicParser<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for BasicParser<T>
where T: RefUnwindSafe,

§

impl<T> Send for BasicParser<T>
where T: Send,

§

impl<T> Sync for BasicParser<T>
where T: Sync,

§

impl<T> Unpin for BasicParser<T>
where T: Unpin,

§

impl<T> UnwindSafe for BasicParser<T>
where T: UnwindSafe,

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

impl<T> Parser for T
where T: TokenStream<Token>,