From 978ca03cb2f46e13f9f8d512e17867aa26e8432f Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Thu, 19 Jul 2012 07:53:55 -0700 Subject: Revert "accept naked exprs with commas in pattern arms" due to pretty-printing failures This reverts commit f712b2d76b1077a2241916cc3269aa1d83ce3088. 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. --- src/libsyntax/parse/parser.rs | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'src/libsyntax/parse/parser.rs') diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index a6bce303ee5..9d2fb947451 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -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; -- cgit 1.4.1-3-g733a5