From f6e5ea250dded087992cdd6c7f91aa2023bfa350 Mon Sep 17 00:00:00 2001 From: greg Date: Thu, 5 Jan 2017 02:53:41 -0800 Subject: [PATCH] Convert while_expr to delimiter_block! too --- src/parser.rs | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index 1bc8065..51cb9f7 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -349,22 +349,12 @@ impl Parser { let test = try!(self.expression()); + let body = delimiter_block!( + self, + expression, + Some(Keyword(Kw::End)) + ); - let mut body = Vec::new(); - loop { - match self.peek() { - None | - Some(Keyword(Kw::End)) => break, - Some(Semicolon) | Some(Newline) => { - self.next(); - continue; - } - _ => { - let exp = try!(self.expression()); - body.push(exp); - } - } - } expect!(self, Keyword(Kw::End)); Ok(While(Box::new(test), body)) }