Add support for parsing multiple if and while-let patterns

This commit is contained in:
Ville Penttinen 2019-03-04 19:10:14 +02:00
parent bbaf750b10
commit 1f4468a8da
3 changed files with 174 additions and 1 deletions

View file

@ -281,10 +281,20 @@ fn for_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker {
// test cond
// fn foo() { if let Some(_) = None {} }
// fn bar() {
// if let Some(_) | Some(_) = None {}
// if let | Some(_) = None {}
// while let Some(_) | Some(_) = None {}
// while let | Some(_) = None {}
// }
fn cond(p: &mut Parser) {
let m = p.start();
if p.eat(LET_KW) {
p.eat(PIPE);
patterns::pattern(p);
while p.eat(PIPE) {
patterns::pattern(p);
}
p.expect(EQ);
}
expr_no_struct(p);