Struct DefaultParser

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

Implementations§

Source§

impl<'a> DefaultParser<'a>

Source

pub fn new(source: &str, diags: &'a mut BuildDiagnostics) -> Self

Constructor that create a parser from the source code

Source

pub fn consume_ws(&mut self)

Consume all the whitespace

Trait Implementations§

Source§

impl Parser for DefaultParser<'_>

Source§

fn nth(&mut self, n: usize) -> Token

Peek the nth token, not including whitespace and comments

Source§

fn consume(&mut self)

Consume the current token

Source§

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

Reports an error at the current token location

Source§

type Checkpoint = Checkpoint

Source§

fn start_node_impl( &mut self, kind: SyntaxKind, checkpoint: Option<Self::Checkpoint>, _: NodeToken, )

Can only be called by Self::start_node
Source§

fn finish_node_impl(&mut self, _: NodeToken)

Can only be called by Node::drop
Source§

fn checkpoint(&mut self) -> Self::Checkpoint

Source§

fn start_node(&mut self, kind: SyntaxKind) -> Node<'_, Self>

Enter a new node. The node is going to be finished when The return value of this function is dropped Read more
Source§

fn start_node_at( &mut self, checkpoint: Self::Checkpoint, kind: SyntaxKind, ) -> Node<'_, Self>

Source§

fn peek(&mut self) -> Token

Same as nth(0)
Source§

fn expect(&mut self, kind: SyntaxKind) -> bool

Consume the token if it has the right kind, otherwise report a syntax error. Returns true if the token was consumed.
Source§

fn test(&mut self, kind: SyntaxKind) -> bool

If the token if of this type, consume it and return true, otherwise return false
Source§

fn until(&mut self, kind: SyntaxKind)

consume everything until reaching a token of this kind

Auto Trait Implementations§

§

impl<'a> Freeze for DefaultParser<'a>

§

impl<'a> RefUnwindSafe for DefaultParser<'a>

§

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

§

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

§

impl<'a> Unpin for DefaultParser<'a>

§

impl<'a> !UnwindSafe for DefaultParser<'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> 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,