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

View File

@ -349,22 +349,12 @@ impl Parser {
let test = try!(self.expression()); 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)); expect!(self, Keyword(Kw::End));
Ok(While(Box::new(test), body)) Ok(While(Box::new(test), body))
} }