Parse do yeet expressions

This commit is contained in:
Maybe Waffle 2022-12-28 22:42:26 +00:00
parent 3033c3ddbf
commit 4a16afa264
7 changed files with 73 additions and 5 deletions

View file

@ -148,11 +148,16 @@ impl<'t> Parser<'t> {
kinds.contains(self.current())
}
/// Checks if the current token is contextual keyword with text `t`.
/// Checks if the current token is contextual keyword `kw`.
pub(crate) fn at_contextual_kw(&self, kw: SyntaxKind) -> bool {
self.inp.contextual_kind(self.pos) == kw
}
/// Checks if the nth token is contextual keyword `kw`.
pub(crate) fn nth_at_contextual_kw(&self, n: usize, kw: SyntaxKind) -> bool {
self.inp.contextual_kind(self.pos + n) == kw
}
/// Starts a new node in the syntax tree. All nodes and tokens
/// consumed between the `start` and the corresponding `Marker::complete`
/// belong to the same node.