mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Fix nameref parsing
This commit is contained in:
parent
eb99c35b3d
commit
b10e437039
3 changed files with 8 additions and 7 deletions
|
@ -270,10 +270,6 @@ fn name_ref(p: &mut Parser) {
|
||||||
let m = p.start();
|
let m = p.start();
|
||||||
p.bump(IDENT);
|
p.bump(IDENT);
|
||||||
m.complete(p, NAME_REF);
|
m.complete(p, NAME_REF);
|
||||||
} else if p.at(T![self]) {
|
|
||||||
let m = p.start();
|
|
||||||
p.bump(T![self]);
|
|
||||||
m.complete(p, T![self]);
|
|
||||||
} else {
|
} else {
|
||||||
p.err_and_bump("expected identifier");
|
p.err_and_bump("expected identifier");
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,7 +304,13 @@ fn extern_crate_item(p: &mut Parser, m: Marker) {
|
||||||
p.bump(T![extern]);
|
p.bump(T![extern]);
|
||||||
assert!(p.at(T![crate]));
|
assert!(p.at(T![crate]));
|
||||||
p.bump(T![crate]);
|
p.bump(T![crate]);
|
||||||
|
|
||||||
|
if p.at(T![self]) {
|
||||||
|
p.bump(T![self]);
|
||||||
|
} else {
|
||||||
name_ref(p);
|
name_ref(p);
|
||||||
|
}
|
||||||
|
|
||||||
opt_alias(p);
|
opt_alias(p);
|
||||||
p.expect(T![;]);
|
p.expect(T![;]);
|
||||||
m.complete(p, EXTERN_CRATE_ITEM);
|
m.complete(p, EXTERN_CRATE_ITEM);
|
||||||
|
|
|
@ -28,7 +28,6 @@ SOURCE_FILE@0..69
|
||||||
WHITESPACE@49..50 " "
|
WHITESPACE@49..50 " "
|
||||||
CRATE_KW@50..55 "crate"
|
CRATE_KW@50..55 "crate"
|
||||||
WHITESPACE@55..56 " "
|
WHITESPACE@55..56 " "
|
||||||
SELF_KW@56..60
|
|
||||||
SELF_KW@56..60 "self"
|
SELF_KW@56..60 "self"
|
||||||
WHITESPACE@60..61 " "
|
WHITESPACE@60..61 " "
|
||||||
ALIAS@61..67
|
ALIAS@61..67
|
||||||
|
|
Loading…
Reference in a new issue