mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 20:43:21 +00:00
Don't return SyntaxKind from bump
This commit is contained in:
parent
4212d28727
commit
dee7046f7e
4 changed files with 13 additions and 16 deletions
|
@ -174,9 +174,7 @@ fn use_item(p: &mut Parser) {
|
||||||
let la = p.nth(1);
|
let la = p.nth(1);
|
||||||
let m = p.start();
|
let m = p.start();
|
||||||
match (p.current(), la) {
|
match (p.current(), la) {
|
||||||
(STAR, _) => {
|
(STAR, _) => p.bump(),
|
||||||
p.bump();
|
|
||||||
}
|
|
||||||
(COLONCOLON, STAR) => {
|
(COLONCOLON, STAR) => {
|
||||||
p.bump();
|
p.bump();
|
||||||
p.bump();
|
p.bump();
|
||||||
|
|
|
@ -21,11 +21,15 @@ fn visibility(p: &mut Parser) {
|
||||||
p.bump();
|
p.bump();
|
||||||
if p.at(L_PAREN) {
|
if p.at(L_PAREN) {
|
||||||
match p.nth(1) {
|
match p.nth(1) {
|
||||||
CRATE_KW | SELF_KW | SUPER_KW | IN_KW => {
|
CRATE_KW | SELF_KW | SUPER_KW => {
|
||||||
p.bump();
|
p.bump();
|
||||||
if p.bump() == IN_KW {
|
p.bump();
|
||||||
paths::use_path(p);
|
p.expect(R_PAREN);
|
||||||
}
|
}
|
||||||
|
IN_KW => {
|
||||||
|
p.bump();
|
||||||
|
p.bump();
|
||||||
|
paths::use_path(p);
|
||||||
p.expect(R_PAREN);
|
p.expect(R_PAREN);
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
|
|
|
@ -30,12 +30,8 @@ fn path_segment(p: &mut Parser, first: bool) {
|
||||||
p.eat(COLONCOLON);
|
p.eat(COLONCOLON);
|
||||||
}
|
}
|
||||||
match p.current() {
|
match p.current() {
|
||||||
IDENT | SELF_KW | SUPER_KW => {
|
IDENT | SELF_KW | SUPER_KW => p.bump(),
|
||||||
p.bump();
|
_ => p.error().message("expected identifier").emit(),
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
p.error().message("expected identifier").emit();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
segment.complete(p, PATH_SEGMENT);
|
segment.complete(p, PATH_SEGMENT);
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,17 +151,16 @@ impl<'t> Parser<'t> {
|
||||||
ErrorBuilder::new(self)
|
ErrorBuilder::new(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn bump(&mut self) -> SyntaxKind {
|
pub(crate) fn bump(&mut self) {
|
||||||
let kind = self.current();
|
let kind = self.current();
|
||||||
if kind == EOF {
|
if kind == EOF {
|
||||||
return EOF;
|
return;
|
||||||
}
|
}
|
||||||
self.pos += 1;
|
self.pos += 1;
|
||||||
self.event(Event::Token {
|
self.event(Event::Token {
|
||||||
kind,
|
kind,
|
||||||
n_raw_tokens: 1,
|
n_raw_tokens: 1,
|
||||||
});
|
});
|
||||||
kind
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn nth(&self, n: usize) -> SyntaxKind {
|
pub(crate) fn nth(&self, n: usize) -> SyntaxKind {
|
||||||
|
|
Loading…
Reference in a new issue