diff options
| author | Seo Sanghyeon <sanxiyn@gmail.com> | 2014-01-23 01:55:53 +0900 |
|---|---|---|
| committer | Seo Sanghyeon <sanxiyn@gmail.com> | 2014-01-23 01:55:53 +0900 |
| commit | 7689353918aa2ba93b432bc96f2f6dca8665e7bc (patch) | |
| tree | 89a4e74cffc1abce8a9fb7d8ea11af1ae044414d /src/libsyntax/parse | |
| parent | 750d48b0ad1854b389ce1c209484f9146dc7aba0 (diff) | |
| download | rust-7689353918aa2ba93b432bc96f2f6dca8665e7bc.tar.gz rust-7689353918aa2ba93b432bc96f2f6dca8665e7bc.zip | |
Allow trailing commas in argument lists and tuple patterns
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 4e1703fe6b0..557e7e04ebf 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2021,7 +2021,7 @@ impl Parser { let es = self.parse_unspanned_seq( &token::LPAREN, &token::RPAREN, - seq_sep_trailing_disallowed(token::COMMA), + seq_sep_trailing_allowed(token::COMMA), |p| p.parse_expr() ); hi = self.last_span.hi; @@ -2994,6 +2994,7 @@ impl Parser { if self.look_ahead(1, |t| *t != token::RPAREN) { while self.token == token::COMMA { self.bump(); + if self.token == token::RPAREN { break; } fields.push(self.parse_pat()); } } @@ -3573,7 +3574,7 @@ impl Parser { self.parse_unspanned_seq( &token::LPAREN, &token::RPAREN, - seq_sep_trailing_disallowed(token::COMMA), + seq_sep_trailing_allowed(token::COMMA), |p| { if p.token == token::DOTDOTDOT { p.bump(); |
