From 83aa6f0899fa3d8de87389d789d0e330739d0117 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 28 Jan 2018 12:57:03 +0300 Subject: Simplify item parsing --- src/parser/event_parser/grammar/items.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/parser/event_parser/grammar/items.rs') diff --git a/src/parser/event_parser/grammar/items.rs b/src/parser/event_parser/grammar/items.rs index e569e5047..0638e3093 100644 --- a/src/parser/event_parser/grammar/items.rs +++ b/src/parser/event_parser/grammar/items.rs @@ -1,8 +1,8 @@ use super::*; -pub(super) fn mod_contents(p: &mut Parser) { +pub(super) fn mod_contents(p: &mut Parser, stop_on_r_curly: bool) { attributes::inner_attributes(p); - while !p.at(EOF) { + while !p.at(EOF) && !(stop_on_r_curly && p.at(R_CURLY)) { item(p); } } @@ -152,7 +152,10 @@ fn mod_item(p: &mut Parser) { p.bump(); if p.expect(IDENT) && !p.eat(SEMI) { - p.curly_block(mod_contents); + if p.expect(L_CURLY) { + mod_contents(p, true); + p.expect(R_CURLY); + } } } -- cgit v1.2.3