Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/parser/event_parser/grammar/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ fn use_item(p: &mut Parser) {
let la = p.nth(1);
let m = p.start();
match (p.current(), la) {
(STAR, _) => {
p.bump();
}
(STAR, _) => p.bump(),
(COLONCOLON, STAR) => {
p.bump();
p.bump();
Expand Down
12 changes: 8 additions & 4 deletions src/parser/event_parser/grammar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ fn visibility(p: &mut Parser) {
p.bump();
if p.at(L_PAREN) {
match p.nth(1) {
CRATE_KW | SELF_KW | SUPER_KW | IN_KW => {
CRATE_KW | SELF_KW | SUPER_KW => {
p.bump();
if p.bump() == IN_KW {
paths::use_path(p);
}
p.bump();
p.expect(R_PAREN);
}
IN_KW => {
p.bump();
p.bump();
paths::use_path(p);
p.expect(R_PAREN);
}
_ => (),
Expand Down
8 changes: 2 additions & 6 deletions src/parser/event_parser/grammar/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,8 @@ fn path_segment(p: &mut Parser, first: bool) {
p.eat(COLONCOLON);
}
match p.current() {
IDENT | SELF_KW | SUPER_KW => {
p.bump();
}
_ => {
p.error().message("expected identifier").emit();
}
IDENT | SELF_KW | SUPER_KW => p.bump(),
_ => p.error().message("expected identifier").emit(),
};
segment.complete(p, PATH_SEGMENT);
}
5 changes: 2 additions & 3 deletions src/parser/event_parser/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,16 @@ impl<'t> Parser<'t> {
ErrorBuilder::new(self)
}

pub(crate) fn bump(&mut self) -> SyntaxKind {
pub(crate) fn bump(&mut self) {
let kind = self.current();
if kind == EOF {
return EOF;
return;
}
self.pos += 1;
self.event(Event::Token {
kind,
n_raw_tokens: 1,
});
kind
}

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