Parser

Struct Parser 

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

Implementations§

Source§

impl<'a> Parser<'a>

Source

pub fn new( bump: &'a Bump, atoms: &'static dyn DynAtomSet, source_text: &'a str, ) -> Self

Create a new parser

Source

pub fn with_features(self, features: Feature) -> Self

Source

pub fn new_with_features( bump: &'a Bump, atoms: &'static dyn DynAtomSet, source_text: &'a str, features: Feature, ) -> Self

Source

pub fn bump(&self) -> &'a Bump

Source

pub fn enabled(&self, other: Feature) -> bool

Source

pub fn is(&self, state: State) -> bool

Source

pub fn set_state(&mut self, state: State) -> State

Source

pub fn set_skip(&mut self, skip: KindSet) -> KindSet

Source

pub fn set_stop(&mut self, stop: KindSet) -> KindSet

Source

pub fn parse_entirely<T: Parse<'a> + ToCursors>( &mut self, ) -> ParserReturn<'a, T>

Source

pub fn parse<T: Parse<'a>>(&mut self) -> Result<T>

Source

pub fn peek<T: Peek<'a>>(&self) -> bool

Source

pub fn parse_if_peek<T: Peek<'a> + Parse<'a>>(&mut self) -> Result<Option<T>>

Source

pub fn try_parse<T: Parse<'a>>(&mut self) -> Result<T>

Source

pub fn try_parse_if_peek<T: Peek<'a> + Parse<'a>>( &mut self, ) -> Result<Option<T>>

Source

pub fn equals_atom(&self, c: Cursor, atom: &'static dyn DynAtomSet) -> bool

Source

pub fn to_atom<A: AtomSet + PartialEq>(&self, c: Cursor) -> A

Source

pub fn offset(&self) -> SourceOffset

Source

pub fn at_end(&self) -> bool

Source

pub fn rewind(&mut self, checkpoint: ParserCheckpoint)

Source

pub fn checkpoint(&self) -> ParserCheckpoint

Source

pub fn next_is_stop(&self) -> bool

Source

pub fn peek_n(&self, n: u8) -> Cursor

Source

pub fn to_source_cursor(&self, cursor: Cursor) -> SourceCursor<'a>

Source

pub fn consume_trivia(&mut self) -> Vec<'a, Cursor>

Source

pub fn next(&mut self) -> Cursor

Trait Implementations§

Source§

impl<'a> Debug for Parser<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Parser<'a>

§

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

§

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

§

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

§

impl<'a> Unpin for Parser<'a>

§

impl<'a> !UnwindSafe for Parser<'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.