From 13c6a34354598484e480e6b31e23ed474ded9988 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 22 Jan 2018 11:29:32 +0300 Subject: Extract nested trees --- src/parser/event_parser/grammar/items.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/parser/event_parser/grammar') diff --git a/src/parser/event_parser/grammar/items.rs b/src/parser/event_parser/grammar/items.rs index d341dce38..39295edf6 100644 --- a/src/parser/event_parser/grammar/items.rs +++ b/src/parser/event_parser/grammar/items.rs @@ -192,9 +192,7 @@ fn use_item(p: &mut Parser) { if p.at(COLONCOLON) { p.bump(); } - p.curly_block(|p| { - comma_list(p, EOF, use_tree); - }); + nested_trees(p); } _ if paths::is_path_start(p) => { paths::use_path(p); @@ -208,11 +206,7 @@ fn use_item(p: &mut Parser) { STAR => { p.bump(); } - L_CURLY => { - p.curly_block(|p| { - comma_list(p, EOF, use_tree); - }); - } + L_CURLY => nested_trees(p), _ => { // is this unreachable? p.error() @@ -232,6 +226,11 @@ fn use_item(p: &mut Parser) { m.complete(p, USE_TREE); return true; } + + fn nested_trees(p: &mut Parser) { + assert!(p.at(L_CURLY)); + p.curly_block(|p| comma_list(p, EOF, use_tree)); + } } -- cgit v1.2.3