Revert "accept naked exprs with commas in pattern arms" due to pretty-printing failures
This reverts commit f712b2d76b
.
In alt arms, the parser needs to do a little lookahead to determine
whether it's looking at a record literal or a block.
Also there are some indentation issues in the expected source.
This commit is contained in:
parent
00aa5f163f
commit
978ca03cb2
6 changed files with 6 additions and 76 deletions
|
@ -1509,25 +1509,8 @@ class parser {
|
|||
let pats = self.parse_pats();
|
||||
let mut guard = none;
|
||||
if self.eat_keyword(~"if") { guard = some(self.parse_expr()); }
|
||||
let blk = if self.token != token::FAT_ARROW {
|
||||
self.parse_block()
|
||||
} else {
|
||||
self.bump();
|
||||
if self.token == token::LBRACE {
|
||||
self.parse_block()
|
||||
} else {
|
||||
let expr = self.parse_expr();
|
||||
if self.token != token::RBRACE {
|
||||
self.expect(token::COMMA);
|
||||
}
|
||||
{node: {view_items: ~[],
|
||||
stmts: ~[],
|
||||
expr: some(expr),
|
||||
id: self.get_id(),
|
||||
rules: default_blk},
|
||||
span: expr.span}
|
||||
}
|
||||
};
|
||||
if self.token == token::FAT_ARROW { self.bump(); }
|
||||
let blk = self.parse_block();
|
||||
vec::push(arms, {pats: pats, guard: guard, body: blk});
|
||||
}
|
||||
let mut hi = self.span.hi;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue