about summary refs log tree commit diff
path: root/crates/parser/src/parser.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/parser/src/parser.rs')
-rw-r--r--crates/parser/src/parser.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/parser/src/parser.rs b/crates/parser/src/parser.rs
index 30bd0b3b169..48aecb35be1 100644
--- a/crates/parser/src/parser.rs
+++ b/crates/parser/src/parser.rs
@@ -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.