diff options
Diffstat (limited to 'src/parser_api.rs')
-rw-r--r-- | src/parser_api.rs | 11 |
1 files changed, 11 insertions, 0 deletions
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> { | |||
58 | self.current() == kind | 58 | self.current() == kind |
59 | } | 59 | } |
60 | 60 | ||
61 | pub(crate) fn at_compound2(&self, c1: SyntaxKind, c2: SyntaxKind) -> bool { | ||
62 | self.0.at_compound2(c1, c2) | ||
63 | } | ||
64 | |||
61 | /// Checks if the current token is contextual keyword with text `t`. | 65 | /// Checks if the current token is contextual keyword with text `t`. |
62 | pub(crate) fn at_contextual_kw(&self, t: &str) -> bool { | 66 | pub(crate) fn at_contextual_kw(&self, t: &str) -> bool { |
63 | self.0.at_kw(t) | 67 | self.0.at_kw(t) |
@@ -85,6 +89,13 @@ impl<'t> Parser<'t> { | |||
85 | self.0.bump_remap(kind); | 89 | self.0.bump_remap(kind); |
86 | } | 90 | } |
87 | 91 | ||
92 | /// Advances the parser by `n` tokens, remapping its kind. | ||
93 | /// This is useful to create compound tokens from parts. For | ||
94 | /// example, an `<<` token is two consecutive remapped `<` tokens | ||
95 | pub(crate) fn bump_compound(&mut self, kind: SyntaxKind, n: u8) { | ||
96 | self.0.bump_compound(kind, n); | ||
97 | } | ||
98 | |||
88 | /// Emit error with the `message` | 99 | /// Emit error with the `message` |
89 | /// TODO: this should be much more fancy and support | 100 | /// TODO: this should be much more fancy and support |
90 | /// structured errors with spans and notes, like rustc | 101 | /// structured errors with spans and notes, like rustc |