Implement RFC 1925

This commit is contained in:
Matt Ickstadt 2017-08-26 17:09:31 -05:00
parent ed532c0d93
commit f866152991
7 changed files with 81 additions and 2 deletions

View file

@ -3155,6 +3155,12 @@ impl<'a> Parser<'a> {
maybe_whole!(self, NtArm, |x| x);
let attrs = self.parse_outer_attributes()?;
// Allow a '|' before the pats (RFC 1925)
let beginning_vert = if self.eat(&token::BinOp(token::Or)) {
Some(self.prev_span)
} else {
None
};
let pats = self.parse_pats()?;
let guard = if self.eat_keyword(keywords::If) {
Some(self.parse_expr()?)
@ -3178,6 +3184,7 @@ impl<'a> Parser<'a> {
pats,
guard,
body: expr,
beginning_vert,
})
}