diff --git a/src/parser/event_parser/grammar/paths.rs b/src/parser/event_parser/grammar/paths.rs index 96966b380b3..74b0e0ed4ad 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) { 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, |_| ()) } \ 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 00000000000..1e71b7a6c5d --- /dev/null +++ b/tests/data/parser/ok/0010_use_path_segments.rs @@ -0,0 +1,2 @@ +use ::foo::bar::baz; +use 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 00000000000..cad609087a8 --- /dev/null +++ b/tests/data/parser/ok/0010_use_path_segments.txt @@ -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)