aboutsummaryrefslogtreecommitdiff
path: root/src/parser/parser.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-02-04 14:07:09 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-02-04 14:07:09 +0000
commit550b17d7cf321c2aebff75d00b1654b55beca53c (patch)
treea7759795877d2d5fef25915997c2679af0cd3e94 /src/parser/parser.rs
parentb86e87c8885895e5b3fcec021ee65003d64c4cbe (diff)
parent351107d0b143e2c3497bd0f424f0d76bc51df0c0 (diff)
Merge #43
43: Ctx r=matklad a=matklad
Diffstat (limited to 'src/parser/parser.rs')
-rw-r--r--src/parser/parser.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/parser/parser.rs b/src/parser/parser.rs
index bb775c4a5..752d532d0 100644
--- a/src/parser/parser.rs
+++ b/src/parser/parser.rs
@@ -145,10 +145,26 @@ impl<'t> Parser<'t> {
145 }); 145 });
146 } 146 }
147 147
148 pub(crate) fn bump_remap(&mut self, kind: SyntaxKind) {
149 if self.current() == EOF {
150 // TODO: panic!?
151 return;
152 }
153 self.pos += 1;
154 self.event(Event::Token {
155 kind,
156 n_raw_tokens: 1,
157 });
158 }
159
148 pub(crate) fn nth(&self, n: u32) -> SyntaxKind { 160 pub(crate) fn nth(&self, n: u32) -> SyntaxKind {
149 self.inp.kind(self.pos + n) 161 self.inp.kind(self.pos + n)
150 } 162 }
151 163
164 pub(crate) fn at_kw(&self, t: &str) -> bool {
165 self.inp.text(self.pos) == t
166 }
167
152 pub(crate) fn current(&self) -> SyntaxKind { 168 pub(crate) fn current(&self) -> SyntaxKind {
153 self.nth(0) 169 self.nth(0)
154 } 170 }