Trait sixtyfps_compilerlib::parser::Parser [−][src]
pub trait Parser: Sized { type Checkpoint: Clone; #[must_use = "use start_node_at to use this checkpoint"] 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>); #[must_use = "The node will be finished when it is dropped"] fn start_node(&mut self, kind: SyntaxKind) -> Node<'_, Self> { ... } #[must_use = "The node will be finished when it is dropped"] fn start_node_at(
&mut self,
checkpoint: 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) { ... } }
Associated Types
type Checkpoint: Clone
[src]
Required methods
#[must_use = "use start_node_at to use this checkpoint"]fn checkpoint(&mut self) -> Self::Checkpoint
[src]
#[must_use = "use start_node_at to use this checkpoint"]
fn checkpoint(&mut self) -> Self::Checkpointfn finish_node_impl(&mut self, token: NodeToken)
[src]
Can only be called by Node::drop
fn start_node_impl(
&mut self,
kind: SyntaxKind,
checkpoint: Option<Self::Checkpoint>,
token: NodeToken
)
[src]
&mut self,
kind: SyntaxKind,
checkpoint: Option<Self::Checkpoint>,
token: NodeToken
)
Can only be called by Self::start_node
fn nth(&mut self, n: usize) -> Token
[src]
Peek the n’th token, not including whitespaces and comments
fn consume(&mut self)
[src]
fn error(&mut self, e: impl Into<String>)
[src]
Provided methods
#[must_use = "The node will be finished when it is dropped"]fn start_node(&mut self, kind: SyntaxKind) -> Node<'_, Self>
[src]
#[must_use = "The node will be finished when it is dropped"]
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 drop’ed
(do not re-implement this function, re-implement start_node_impl and finish_node_impl)
#[must_use = "The node will be finished when it is dropped"]fn start_node_at(
&mut self,
checkpoint: Self::Checkpoint,
kind: SyntaxKind
) -> Node<'_, Self>
[src]
#[must_use = "The node will be finished when it is dropped"]
fn start_node_at(&mut self,
checkpoint: Self::Checkpoint,
kind: SyntaxKind
) -> Node<'_, Self>
fn peek(&mut self) -> Token
[src]
Same as nth(0)
fn expect(&mut self, kind: SyntaxKind) -> bool
[src]
Consume the token if it has the right kind, otherwise report a syntax error. Returns true if the token was consumed.
fn test(&mut self, kind: SyntaxKind) -> bool
[src]
If the token if of this type, consume it and return true, otherwise return false
fn until(&mut self, kind: SyntaxKind)
[src]
consume everyting until reaching a token of this kind
Implementors
impl Parser for DefaultParser<'_>
[src]
impl Parser for DefaultParser<'_>
[src]fn start_node_impl(
&mut self,
kind: SyntaxKind,
checkpoint: Option<Self::Checkpoint>,
_: NodeToken
)
[src]
&mut self,
kind: SyntaxKind,
checkpoint: Option<Self::Checkpoint>,
_: NodeToken
)
fn finish_node_impl(&mut self, _: NodeToken)
[src]
fn nth(&mut self, n: usize) -> Token
[src]
Peek the n’th token, not including whitespaces and comments
fn consume(&mut self)
[src]
Consume the current token
fn error(&mut self, e: impl Into<String>)
[src]
Reports an error at the current token location