Skip to content

Commit 4adf0c2

Browse files
committed
Merge #28
28: Don't return SyntaxKind from bump r=matklad a=matklad
2 parents 4212d28 + dee7046 commit 4adf0c2

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

src/parser/event_parser/grammar/items.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,7 @@ fn use_item(p: &mut Parser) {
174174
let la = p.nth(1);
175175
let m = p.start();
176176
match (p.current(), la) {
177-
(STAR, _) => {
178-
p.bump();
179-
}
177+
(STAR, _) => p.bump(),
180178
(COLONCOLON, STAR) => {
181179
p.bump();
182180
p.bump();

src/parser/event_parser/grammar/mod.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,15 @@ fn visibility(p: &mut Parser) {
2121
p.bump();
2222
if p.at(L_PAREN) {
2323
match p.nth(1) {
24-
CRATE_KW | SELF_KW | SUPER_KW | IN_KW => {
24+
CRATE_KW | SELF_KW | SUPER_KW => {
2525
p.bump();
26-
if p.bump() == IN_KW {
27-
paths::use_path(p);
28-
}
26+
p.bump();
27+
p.expect(R_PAREN);
28+
}
29+
IN_KW => {
30+
p.bump();
31+
p.bump();
32+
paths::use_path(p);
2933
p.expect(R_PAREN);
3034
}
3135
_ => (),

src/parser/event_parser/grammar/paths.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,8 @@ fn path_segment(p: &mut Parser, first: bool) {
3030
p.eat(COLONCOLON);
3131
}
3232
match p.current() {
33-
IDENT | SELF_KW | SUPER_KW => {
34-
p.bump();
35-
}
36-
_ => {
37-
p.error().message("expected identifier").emit();
38-
}
33+
IDENT | SELF_KW | SUPER_KW => p.bump(),
34+
_ => p.error().message("expected identifier").emit(),
3935
};
4036
segment.complete(p, PATH_SEGMENT);
4137
}

src/parser/event_parser/parser.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,16 @@ impl<'t> Parser<'t> {
151151
ErrorBuilder::new(self)
152152
}
153153

154-
pub(crate) fn bump(&mut self) -> SyntaxKind {
154+
pub(crate) fn bump(&mut self) {
155155
let kind = self.current();
156156
if kind == EOF {
157-
return EOF;
157+
return;
158158
}
159159
self.pos += 1;
160160
self.event(Event::Token {
161161
kind,
162162
n_raw_tokens: 1,
163163
});
164-
kind
165164
}
166165

167166
pub(crate) fn nth(&self, n: usize) -> SyntaxKind {

0 commit comments

Comments
 (0)