Fix nameref parsing

This commit is contained in:
Aleksey Kladov 2020-07-28 20:59:48 +02:00
parent eb99c35b3d
commit b10e437039
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]);
name_ref(p);
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,8 +28,7 @@ SOURCE_FILE@0..69
WHITESPACE@49..50 " "
CRATE_KW@50..55 "crate"
WHITESPACE@55..56 " "
SELF_KW@56..60
SELF_KW@56..60 "self"
SELF_KW@56..60 "self"
WHITESPACE@60..61 " "
ALIAS@61..67
AS_KW@61..63 "as"