From 89699c4803a0d12155adf653742f463872667610 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 11 Jan 2018 22:11:44 +0300 Subject: G: leading colon is a part of path segment --- src/parser/event_parser/grammar/paths.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/parser/event_parser/grammar/paths.rs b/src/parser/event_parser/grammar/paths.rs index 74b0e0ed4..16a8ce239 100644 --- a/src/parser/event_parser/grammar/paths.rs +++ b/src/parser/event_parser/grammar/paths.rs @@ -5,16 +5,20 @@ pub(crate) fn use_path(p: &mut Parser) { return; } node(p, PATH, |p| { - p.eat(COLONCOLON); - path_segment(p); + path_segment(p, true); }); many(p, |p| { node_if(p, COLONCOLON, PATH, |p| { - path_segment(p); + path_segment(p, false); }) }); } -fn path_segment(p: &mut Parser) -> bool { - node_if(p, IDENT, PATH_SEGMENT, |_| ()) +fn path_segment(p: &mut Parser, first: bool) { + node(p, PATH_SEGMENT, |p| { + if first { + p.eat(COLONCOLON); + } + p.expect(IDENT); + }) } \ No newline at end of file -- cgit v1.2.3