allow aliases in underscores

this helps with

    use foo::Trait as _;

syntax
This commit is contained in:
Aleksey Kladov 2019-03-04 16:38:54 +03:00
parent dc8bcc1e42
commit 0a19f4f1b4
4 changed files with 21 additions and 2 deletions

View File

@ -129,7 +129,9 @@ fn opt_alias(p: &mut Parser) {
if p.at(AS_KW) {
let m = p.start();
p.bump();
if !p.eat(UNDERSCORE) {
name(p);
}
m.complete(p, ALIAS);
}
}

View File

@ -76,6 +76,7 @@ fn use_tree(p: &mut Parser) {
// yet::another::path,
// running::out::of::synonyms::for_::different::*
// };
// use Trait as _;
opt_alias(p);
}
COLONCOLON => {

View File

@ -5,3 +5,4 @@
yet::another::path,
running::out::of::synonyms::for_::different::*
};
use Trait as _;

View File

@ -1,4 +1,4 @@
SOURCE_FILE@[0; 182)
SOURCE_FILE@[0; 198)
USE_ITEM@[0; 28)
USE_KW@[0; 3)
WHITESPACE@[3; 4)
@ -121,3 +121,18 @@ SOURCE_FILE@[0; 182)
R_CURLY@[179; 180)
SEMI@[180; 181)
WHITESPACE@[181; 182)
USE_ITEM@[182; 197)
USE_KW@[182; 185)
WHITESPACE@[185; 186)
USE_TREE@[186; 196)
PATH@[186; 191)
PATH_SEGMENT@[186; 191)
NAME_REF@[186; 191)
IDENT@[186; 191) "Trait"
WHITESPACE@[191; 192)
ALIAS@[192; 196)
AS_KW@[192; 194)
WHITESPACE@[194; 195)
UNDERSCORE@[195; 196)
SEMI@[196; 197)
WHITESPACE@[197; 198)