From 1e1e2e83c462b7efacaa0e33812beed72a88ab5f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 5 Aug 2018 16:09:25 +0300 Subject: compound ops --- src/parser_api.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/parser_api.rs') diff --git a/src/parser_api.rs b/src/parser_api.rs index 95394e39d..fef21c5fd 100644 --- a/src/parser_api.rs +++ b/src/parser_api.rs @@ -58,6 +58,10 @@ impl<'t> Parser<'t> { self.current() == kind } + pub(crate) fn at_compound2(&self, c1: SyntaxKind, c2: SyntaxKind) -> bool { + self.0.at_compound2(c1, c2) + } + /// 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) @@ -85,6 +89,13 @@ impl<'t> Parser<'t> { self.0.bump_remap(kind); } + /// Advances the parser by `n` tokens, remapping its kind. + /// This is useful to create compound tokens from parts. For + /// example, an `<<` token is two consecutive remapped `<` tokens + pub(crate) fn bump_compound(&mut self, kind: SyntaxKind, n: u8) { + self.0.bump_compound(kind, n); + } + /// Emit error with the `message` /// TODO: this should be much more fancy and support /// structured errors with spans and notes, like rustc -- cgit v1.2.3