diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2012-07-19 07:53:55 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2012-07-19 07:53:55 -0700 |
| commit | 978ca03cb2f46e13f9f8d512e17867aa26e8432f (patch) | |
| tree | bfff59f98c3d1f55a1182fa2734d80d2231af8dc /src/libsyntax/parse/parser.rs | |
| parent | 00aa5f163f154585814991cb6d1b0c9eef6ecc56 (diff) | |
| download | rust-978ca03cb2f46e13f9f8d512e17867aa26e8432f.tar.gz rust-978ca03cb2f46e13f9f8d512e17867aa26e8432f.zip | |
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.
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 21 |
1 files changed, 2 insertions, 19 deletions
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; |
