Convert while_expr to delimiter_block! too

This commit is contained in:
greg 2017-01-05 02:53:41 -08:00
parent 9801f53a17
commit f6e5ea250d
1 changed files with 5 additions and 15 deletions

View File

@ -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))
}