Skip to main content

Parser

Struct Parser 

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

Implementations§

Source§

impl<'ctx> Parser<'ctx>

Source

pub fn new(ctx: &'ctx mut BuildCtx, tokens: Vec<Token>) -> Self

Source

pub fn make_tree(&mut self) -> Vec<Node>

Source

pub fn open(&mut self) -> OpenHandle

Source

pub fn close(&mut self, handle: OpenHandle, new_kind: TreeKind) -> CloseHandle

Source

pub fn open_before(&mut self, handle: CloseHandle) -> OpenHandle

Source

pub fn wrap(&mut self, handle: CloseHandle, kind: TreeKind) -> CloseHandle

Source

pub fn peek_kind<'inp: 'out, 'out>(&'inp mut self) -> Option<&'out TokenKind>

Source

pub fn peek(&mut self) -> Tt

Source

pub fn nth_raw(&mut self, ofs: usize) -> Option<Tt>

Get token kind ofs tokens from cursor This does not skip non-significant tokens!

Source

pub fn nth(&mut self, ofs: usize) -> Tt

Source

pub fn nth_is(&mut self, ofs: usize, ty: impl Into<Tt>) -> bool

Source

pub fn advance(&mut self)

Source

pub fn eof(&self) -> bool

Source

pub fn at(&mut self, ty: impl Into<Tt>) -> bool

Source

pub fn at_set(&mut self, tys: &TtSet) -> bool

Source

pub fn at_id(&mut self, str: &str) -> bool

Source

pub fn eof_or(&mut self, ty: impl Into<Tt>) -> bool

Source

pub fn eat(&mut self, ty: impl Into<Tt>) -> bool

Source

pub fn advance_error(&mut self, message: impl Into<String>) -> CloseHandle

Source

pub fn error_empty(&mut self, message: impl Into<String>) -> CloseHandle

Source

pub fn error(&mut self, message: impl Into<String>)

Source

pub fn expect(&mut self, ty: impl Into<Tt>)

Source

pub fn assert(&mut self, ty: impl Into<Tt>)

Source

pub fn kind_of(&self, handle: CloseHandle) -> TreeKind

Auto Trait Implementations§

§

impl<'ctx> !Freeze for Parser<'ctx>

§

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

§

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

§

impl<'ctx> !UnwindSafe for Parser<'ctx>

§

impl<'ctx> Send for Parser<'ctx>

§

impl<'ctx> Unpin for Parser<'ctx>

§

impl<'ctx> UnsafeUnpin for Parser<'ctx>

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> ErasedDestructor for T
where T: 'static,

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