mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 17:53:56 +00:00
G: multisegment paths
This commit is contained in:
parent
adb8378827
commit
41bf98d249
@ -7,9 +7,14 @@ pub(crate) fn use_path(p: &mut Parser) {
|
||||
node(p, PATH, |p| {
|
||||
p.eat(COLONCOLON);
|
||||
path_segment(p);
|
||||
})
|
||||
});
|
||||
many(p, |p| {
|
||||
node_if(p, COLONCOLON, PATH, |p| {
|
||||
path_segment(p);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
fn path_segment(p: &mut Parser) -> bool {
|
||||
node_if(p, IDENT, PATH_SEGMENT, |p| ())
|
||||
node_if(p, IDENT, PATH_SEGMENT, |_| ())
|
||||
}
|
2
tests/data/parser/ok/0010_use_path_segments.rs
Normal file
2
tests/data/parser/ok/0010_use_path_segments.rs
Normal file
@ -0,0 +1,2 @@
|
||||
use ::foo::bar::baz;
|
||||
use foo::bar::baz;
|
34
tests/data/parser/ok/0010_use_path_segments.txt
Normal file
34
tests/data/parser/ok/0010_use_path_segments.txt
Normal file
@ -0,0 +1,34 @@
|
||||
FILE@[0; 40)
|
||||
USE_ITEM@[0; 21)
|
||||
USE_KW@[0; 3)
|
||||
PATH@[3; 9)
|
||||
WHITESPACE@[3; 4)
|
||||
COLONCOLON@[4; 6)
|
||||
PATH_SEGMENT@[6; 9)
|
||||
IDENT@[6; 9)
|
||||
PATH@[9; 14)
|
||||
COLONCOLON@[9; 11)
|
||||
PATH_SEGMENT@[11; 14)
|
||||
IDENT@[11; 14)
|
||||
PATH@[14; 19)
|
||||
COLONCOLON@[14; 16)
|
||||
PATH_SEGMENT@[16; 19)
|
||||
IDENT@[16; 19)
|
||||
SEMI@[19; 20)
|
||||
WHITESPACE@[20; 21)
|
||||
USE_ITEM@[21; 40)
|
||||
USE_KW@[21; 24)
|
||||
PATH@[24; 28)
|
||||
PATH_SEGMENT@[24; 28)
|
||||
WHITESPACE@[24; 25)
|
||||
IDENT@[25; 28)
|
||||
PATH@[28; 33)
|
||||
COLONCOLON@[28; 30)
|
||||
PATH_SEGMENT@[30; 33)
|
||||
IDENT@[30; 33)
|
||||
PATH@[33; 38)
|
||||
COLONCOLON@[33; 35)
|
||||
PATH_SEGMENT@[35; 38)
|
||||
IDENT@[35; 38)
|
||||
SEMI@[38; 39)
|
||||
WHITESPACE@[39; 40)
|
Loading…
Reference in New Issue
Block a user