Convert while_expr to delimiter_block! too
This commit is contained in:
parent
9801f53a17
commit
f6e5ea250d
@ -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))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user