pub trait Parser: Sized {
    type Checkpoint: Clone;

Show 13 methods // Required methods fn checkpoint(&mut self) -> Self::Checkpoint; fn finish_node_impl(&mut self, token: NodeToken); fn start_node_impl( &mut self, kind: SyntaxKind, checkpoint: Option<Self::Checkpoint>, token: NodeToken ); fn nth(&mut self, n: usize) -> Token; fn consume(&mut self); fn error(&mut self, e: impl Into<String>); fn warning(&mut self, e: impl Into<String>); // Provided methods fn start_node(&mut self, kind: SyntaxKind) -> Node<'_, Self> { ... } fn start_node_at( &mut self, checkpoint: impl Into<Option<Self::Checkpoint>>, kind: SyntaxKind ) -> Node<'_, Self> { ... } fn peek(&mut self) -> Token { ... } fn expect(&mut self, kind: SyntaxKind) -> bool { ... } fn test(&mut self, kind: SyntaxKind) -> bool { ... } fn until(&mut self, kind: SyntaxKind) { ... }
}

Required Associated Types§

Required Methods§

source

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

source

fn finish_node_impl(&mut self, token: NodeToken)

Can only be called by Node::drop

source

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

Can only be called by Self::start_node

source

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

Peek the nth token, not including whitespace and comments

source

fn consume(&mut self)

source

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

source

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

Provided Methods§

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

(do not re-implement this function, re-implement start_node_impl and finish_node_impl)

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

Implementors§