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§

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

Reports an error at the current token location

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
§

type Checkpoint = Checkpoint

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: impl Into<Option<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> 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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.