diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-01-28 11:59:12 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-01-28 11:59:12 +0000 |
commit | 4adf0c20b71f8eb6365893cb1739b1cd33b081cc (patch) | |
tree | 81136bfa035035ee838717f8296a79f044dc0d48 /src/parser/event_parser | |
parent | 4212d28727fca0de8c3f5d4504025c3028425386 (diff) | |
parent | dee7046f7eefbaef1d8ab97517b14139fbf696ce (diff) |
Merge #28
28: Don't return SyntaxKind from bump r=matklad a=matklad
Diffstat (limited to 'src/parser/event_parser')
-rw-r--r-- | src/parser/event_parser/grammar/items.rs | 4 | ||||
-rw-r--r-- | src/parser/event_parser/grammar/mod.rs | 12 | ||||
-rw-r--r-- | src/parser/event_parser/grammar/paths.rs | 8 | ||||
-rw-r--r-- | src/parser/event_parser/parser.rs | 5 |
4 files changed, 13 insertions, 16 deletions
diff --git a/src/parser/event_parser/grammar/items.rs b/src/parser/event_parser/grammar/items.rs index 7fed5e83b..309e4f4de 100644 --- a/src/parser/event_parser/grammar/items.rs +++ b/src/parser/event_parser/grammar/items.rs | |||
@@ -174,9 +174,7 @@ fn use_item(p: &mut Parser) { | |||
174 | let la = p.nth(1); | 174 | let la = p.nth(1); |
175 | let m = p.start(); | 175 | let m = p.start(); |
176 | match (p.current(), la) { | 176 | match (p.current(), la) { |
177 | (STAR, _) => { | 177 | (STAR, _) => p.bump(), |
178 | p.bump(); | ||
179 | } | ||
180 | (COLONCOLON, STAR) => { | 178 | (COLONCOLON, STAR) => { |
181 | p.bump(); | 179 | p.bump(); |
182 | p.bump(); | 180 | p.bump(); |
diff --git a/src/parser/event_parser/grammar/mod.rs b/src/parser/event_parser/grammar/mod.rs index 931193b5f..92125acd1 100644 --- a/src/parser/event_parser/grammar/mod.rs +++ b/src/parser/event_parser/grammar/mod.rs | |||
@@ -21,11 +21,15 @@ fn visibility(p: &mut Parser) { | |||
21 | p.bump(); | 21 | p.bump(); |
22 | if p.at(L_PAREN) { | 22 | if p.at(L_PAREN) { |
23 | match p.nth(1) { | 23 | match p.nth(1) { |
24 | CRATE_KW | SELF_KW | SUPER_KW | IN_KW => { | 24 | CRATE_KW | SELF_KW | SUPER_KW => { |
25 | p.bump(); | 25 | p.bump(); |
26 | if p.bump() == IN_KW { | 26 | p.bump(); |
27 | paths::use_path(p); | 27 | p.expect(R_PAREN); |
28 | } | 28 | } |
29 | IN_KW => { | ||
30 | p.bump(); | ||
31 | p.bump(); | ||
32 | paths::use_path(p); | ||
29 | p.expect(R_PAREN); | 33 | p.expect(R_PAREN); |
30 | } | 34 | } |
31 | _ => (), | 35 | _ => (), |
diff --git a/src/parser/event_parser/grammar/paths.rs b/src/parser/event_parser/grammar/paths.rs index 6c8a89f6c..a254ab05e 100644 --- a/src/parser/event_parser/grammar/paths.rs +++ b/src/parser/event_parser/grammar/paths.rs | |||
@@ -30,12 +30,8 @@ fn path_segment(p: &mut Parser, first: bool) { | |||
30 | p.eat(COLONCOLON); | 30 | p.eat(COLONCOLON); |
31 | } | 31 | } |
32 | match p.current() { | 32 | match p.current() { |
33 | IDENT | SELF_KW | SUPER_KW => { | 33 | IDENT | SELF_KW | SUPER_KW => p.bump(), |
34 | p.bump(); | 34 | _ => p.error().message("expected identifier").emit(), |
35 | } | ||
36 | _ => { | ||
37 | p.error().message("expected identifier").emit(); | ||
38 | } | ||
39 | }; | 35 | }; |
40 | segment.complete(p, PATH_SEGMENT); | 36 | segment.complete(p, PATH_SEGMENT); |
41 | } | 37 | } |
diff --git a/src/parser/event_parser/parser.rs b/src/parser/event_parser/parser.rs index a15d0b633..6cf6ac9b9 100644 --- a/src/parser/event_parser/parser.rs +++ b/src/parser/event_parser/parser.rs | |||
@@ -151,17 +151,16 @@ impl<'t> Parser<'t> { | |||
151 | ErrorBuilder::new(self) | 151 | ErrorBuilder::new(self) |
152 | } | 152 | } |
153 | 153 | ||
154 | pub(crate) fn bump(&mut self) -> SyntaxKind { | 154 | pub(crate) fn bump(&mut self) { |
155 | let kind = self.current(); | 155 | let kind = self.current(); |
156 | if kind == EOF { | 156 | if kind == EOF { |
157 | return EOF; | 157 | return; |
158 | } | 158 | } |
159 | self.pos += 1; | 159 | self.pos += 1; |
160 | self.event(Event::Token { | 160 | self.event(Event::Token { |
161 | kind, | 161 | kind, |
162 | n_raw_tokens: 1, | 162 | n_raw_tokens: 1, |
163 | }); | 163 | }); |
164 | kind | ||
165 | } | 164 | } |
166 | 165 | ||
167 | pub(crate) fn nth(&self, n: usize) -> SyntaxKind { | 166 | pub(crate) fn nth(&self, n: usize) -> SyntaxKind { |