slightly better name

This commit is contained in:
Aleksey Kladov 2019-02-20 15:03:31 +03:00
parent df6efe62c5
commit 9d0cda4bc8
3 changed files with 20 additions and 12 deletions

View file

@ -25,6 +25,22 @@ impl<'t> Parser<'t> {
self.nth(0)
}
/// Returns the kinds of the current two tokens, if they are not separated
/// by trivia.
///
/// Useful for parsing things like `>>`.
pub(crate) fn current2(&self) -> Option<(SyntaxKind, SyntaxKind)> {
self.0.current2()
}
/// Returns the kinds of the current three tokens, if they are not separated
/// by trivia.
///
/// Useful for parsing things like `=>>`.
pub(crate) fn current3(&self) -> Option<(SyntaxKind, SyntaxKind, SyntaxKind)> {
self.0.current3()
}
/// Lookahead operation: returns the kind of the next nth
/// token.
pub(crate) fn nth(&self, n: u32) -> SyntaxKind {
@ -41,14 +57,6 @@ impl<'t> Parser<'t> {
kinds.contains(self.current())
}
pub(crate) fn next2(&self) -> Option<(SyntaxKind, SyntaxKind)> {
self.0.next2()
}
pub(crate) fn next3(&self) -> Option<(SyntaxKind, SyntaxKind, SyntaxKind)> {
self.0.next3()
}
/// Checks if the current token is contextual keyword with text `t`.
pub(crate) fn at_contextual_kw(&self, t: &str) -> bool {
self.0.at_kw(t)