aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/parser/event_parser/grammar/paths.rs9
-rw-r--r--tests/data/parser/ok/0010_use_path_segments.rs2
-rw-r--r--tests/data/parser/ok/0010_use_path_segments.txt34
3 files changed, 43 insertions, 2 deletions
diff --git a/src/parser/event_parser/grammar/paths.rs b/src/parser/event_parser/grammar/paths.rs
index 96966b380..74b0e0ed4 100644
--- a/src/parser/event_parser/grammar/paths.rs
+++ b/src/parser/event_parser/grammar/paths.rs
@@ -7,9 +7,14 @@ pub(crate) fn use_path(p: &mut Parser) {
7 node(p, PATH, |p| { 7 node(p, PATH, |p| {
8 p.eat(COLONCOLON); 8 p.eat(COLONCOLON);
9 path_segment(p); 9 path_segment(p);
10 }) 10 });
11 many(p, |p| {
12 node_if(p, COLONCOLON, PATH, |p| {
13 path_segment(p);
14 })
15 });
11} 16}
12 17
13fn path_segment(p: &mut Parser) -> bool { 18fn path_segment(p: &mut Parser) -> bool {
14 node_if(p, IDENT, PATH_SEGMENT, |p| ()) 19 node_if(p, IDENT, PATH_SEGMENT, |_| ())
15} \ No newline at end of file 20} \ No newline at end of file
diff --git a/tests/data/parser/ok/0010_use_path_segments.rs b/tests/data/parser/ok/0010_use_path_segments.rs
new file mode 100644
index 000000000..1e71b7a6c
--- /dev/null
+++ b/tests/data/parser/ok/0010_use_path_segments.rs
@@ -0,0 +1,2 @@
1use ::foo::bar::baz;
2use foo::bar::baz;
diff --git a/tests/data/parser/ok/0010_use_path_segments.txt b/tests/data/parser/ok/0010_use_path_segments.txt
new file mode 100644
index 000000000..cad609087
--- /dev/null
+++ b/tests/data/parser/ok/0010_use_path_segments.txt
@@ -0,0 +1,34 @@
1FILE@[0; 40)
2 USE_ITEM@[0; 21)
3 USE_KW@[0; 3)
4 PATH@[3; 9)
5 WHITESPACE@[3; 4)
6 COLONCOLON@[4; 6)
7 PATH_SEGMENT@[6; 9)
8 IDENT@[6; 9)
9 PATH@[9; 14)
10 COLONCOLON@[9; 11)
11 PATH_SEGMENT@[11; 14)
12 IDENT@[11; 14)
13 PATH@[14; 19)
14 COLONCOLON@[14; 16)
15 PATH_SEGMENT@[16; 19)
16 IDENT@[16; 19)
17 SEMI@[19; 20)
18 WHITESPACE@[20; 21)
19 USE_ITEM@[21; 40)
20 USE_KW@[21; 24)
21 PATH@[24; 28)
22 PATH_SEGMENT@[24; 28)
23 WHITESPACE@[24; 25)
24 IDENT@[25; 28)
25 PATH@[28; 33)
26 COLONCOLON@[28; 30)
27 PATH_SEGMENT@[30; 33)
28 IDENT@[30; 33)
29 PATH@[33; 38)
30 COLONCOLON@[33; 35)
31 PATH_SEGMENT@[35; 38)
32 IDENT@[35; 38)
33 SEMI@[38; 39)
34 WHITESPACE@[39; 40)