pub struct DefaultParser<'a> { /* private fields */ }
Implementations§
Source§impl<'a> DefaultParser<'a>
impl<'a> DefaultParser<'a>
Sourcepub fn new(source: &str, diags: &'a mut BuildDiagnostics) -> Self
pub fn new(source: &str, diags: &'a mut BuildDiagnostics) -> Self
Constructor that create a parser from the source code
Sourcepub fn consume_ws(&mut self)
pub fn consume_ws(&mut self)
Consume all the whitespace
Trait Implementations§
Source§impl Parser for DefaultParser<'_>
impl Parser for DefaultParser<'_>
Source§fn nth(&mut self, n: usize) -> Token
fn nth(&mut self, n: usize) -> Token
Peek the n
th token, not including whitespace and comments
type Checkpoint = Checkpoint
Source§fn start_node_impl(
&mut self,
kind: SyntaxKind,
checkpoint: Option<Self::Checkpoint>,
_: NodeToken,
)
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)
fn finish_node_impl(&mut self, _: NodeToken)
Can only be called by Node::drop
fn checkpoint(&mut self) -> Self::Checkpoint
Source§fn start_node(&mut self, kind: SyntaxKind) -> Node<'_, Self>
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
fn start_node_at( &mut self, checkpoint: Self::Checkpoint, kind: SyntaxKind, ) -> Node<'_, Self>
Source§fn expect(&mut self, kind: SyntaxKind) -> bool
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
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)
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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