diff options
Diffstat (limited to 'src/parser/event_parser/grammar/paths.rs')
-rw-r--r-- | src/parser/event_parser/grammar/paths.rs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/parser/event_parser/grammar/paths.rs b/src/parser/event_parser/grammar/paths.rs index f5124cfce..b58c59aef 100644 --- a/src/parser/event_parser/grammar/paths.rs +++ b/src/parser/event_parser/grammar/paths.rs | |||
@@ -8,19 +8,16 @@ pub(crate) fn use_path(p: &mut Parser) { | |||
8 | if !is_path_start(p) { | 8 | if !is_path_start(p) { |
9 | return; | 9 | return; |
10 | } | 10 | } |
11 | let mut prev = p.mark(); | 11 | let path = p.start(); |
12 | p.start(PATH); | ||
13 | path_segment(p, true); | 12 | path_segment(p, true); |
14 | p.finish(); | 13 | let mut qual = path.complete(p, PATH); |
15 | loop { | 14 | loop { |
16 | let curr = p.mark(); | ||
17 | if p.at(COLONCOLON) && !items::is_use_tree_start(p.raw_lookahead(1)) { | 15 | if p.at(COLONCOLON) && !items::is_use_tree_start(p.raw_lookahead(1)) { |
18 | p.start(PATH); | 16 | let path = qual.precede(p); |
19 | p.bump(); | 17 | p.bump(); |
20 | path_segment(p, false); | 18 | path_segment(p, false); |
21 | p.forward_parent(prev, curr); | 19 | let path = path.complete(p, PATH); |
22 | prev = curr; | 20 | qual = path; |
23 | p.finish(); | ||
24 | } else { | 21 | } else { |
25 | break; | 22 | break; |
26 | } | 23 | } |
@@ -28,7 +25,7 @@ pub(crate) fn use_path(p: &mut Parser) { | |||
28 | } | 25 | } |
29 | 26 | ||
30 | fn path_segment(p: &mut Parser, first: bool) { | 27 | fn path_segment(p: &mut Parser, first: bool) { |
31 | p.start(PATH_SEGMENT); | 28 | let segment = p.start(); |
32 | if first { | 29 | if first { |
33 | p.eat(COLONCOLON); | 30 | p.eat(COLONCOLON); |
34 | } | 31 | } |
@@ -42,5 +39,5 @@ fn path_segment(p: &mut Parser, first: bool) { | |||
42 | .emit(); | 39 | .emit(); |
43 | } | 40 | } |
44 | }; | 41 | }; |
45 | p.finish(); | 42 | segment.complete(p, PATH_SEGMENT); |
46 | } | 43 | } |