5560: Fix nameref parsing r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-07-28 19:00:41 +00:00 committed by GitHub
commit 5a8124273d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions

View file

@ -270,10 +270,6 @@ fn name_ref(p: &mut Parser) {
let m = p.start();
p.bump(IDENT);
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 {
p.err_and_bump("expected identifier");
}

View file

@ -304,7 +304,13 @@ fn extern_crate_item(p: &mut Parser, m: Marker) {
p.bump(T![extern]);
assert!(p.at(T![crate]));
p.bump(T![crate]);
if p.at(T![self]) {
p.bump(T![self]);
} else {
name_ref(p);
}
opt_alias(p);
p.expect(T![;]);
m.complete(p, EXTERN_CRATE_ITEM);

View file

@ -28,7 +28,6 @@ SOURCE_FILE@0..69
WHITESPACE@49..50 " "
CRATE_KW@50..55 "crate"
WHITESPACE@55..56 " "
SELF_KW@56..60
SELF_KW@56..60 "self"
WHITESPACE@60..61 " "
ALIAS@61..67