aboutsummaryrefslogtreecommitdiff
path: root/src/parser_api.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-05 14:09:25 +0100
committerAleksey Kladov <[email protected]>2018-08-05 14:09:25 +0100
commit1e1e2e83c462b7efacaa0e33812beed72a88ab5f (patch)
tree134caad399dc6a3cc4bfccf49d525e8db646a657 /src/parser_api.rs
parent5691da4c84655e0d966ac11406fa7a90bdd02643 (diff)
compound ops
Diffstat (limited to 'src/parser_api.rs')
-rw-r--r--src/parser_api.rs11
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