diff options
author | Aleksey Kladov <[email protected]> | 2018-01-22 08:29:32 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-01-22 08:29:32 +0000 |
commit | 13c6a34354598484e480e6b31e23ed474ded9988 (patch) | |
tree | 6ffaa72c7fcfd266623d8237a9aaebcc76d106d5 /src | |
parent | 645a1b5d739e7101fc63cea7950d26addd8e7be2 (diff) |
Extract nested trees
Diffstat (limited to 'src')
-rw-r--r-- | src/parser/event_parser/grammar/items.rs | 15 |
1 files changed, 7 insertions, 8 deletions
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) { | |||
192 | if p.at(COLONCOLON) { | 192 | if p.at(COLONCOLON) { |
193 | p.bump(); | 193 | p.bump(); |
194 | } | 194 | } |
195 | p.curly_block(|p| { | 195 | nested_trees(p); |
196 | comma_list(p, EOF, use_tree); | ||
197 | }); | ||
198 | } | 196 | } |
199 | _ if paths::is_path_start(p) => { | 197 | _ if paths::is_path_start(p) => { |
200 | paths::use_path(p); | 198 | paths::use_path(p); |
@@ -208,11 +206,7 @@ fn use_item(p: &mut Parser) { | |||
208 | STAR => { | 206 | STAR => { |
209 | p.bump(); | 207 | p.bump(); |
210 | } | 208 | } |
211 | L_CURLY => { | 209 | L_CURLY => nested_trees(p), |
212 | p.curly_block(|p| { | ||
213 | comma_list(p, EOF, use_tree); | ||
214 | }); | ||
215 | } | ||
216 | _ => { | 210 | _ => { |
217 | // is this unreachable? | 211 | // is this unreachable? |
218 | p.error() | 212 | p.error() |
@@ -232,6 +226,11 @@ fn use_item(p: &mut Parser) { | |||
232 | m.complete(p, USE_TREE); | 226 | m.complete(p, USE_TREE); |
233 | return true; | 227 | return true; |
234 | } | 228 | } |
229 | |||
230 | fn nested_trees(p: &mut Parser) { | ||
231 | assert!(p.at(L_CURLY)); | ||
232 | p.curly_block(|p| comma_list(p, EOF, use_tree)); | ||
233 | } | ||
235 | } | 234 | } |
236 | 235 | ||
237 | 236 | ||