about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorSeo Sanghyeon <sanxiyn@gmail.com>2014-01-23 01:55:53 +0900
committerSeo Sanghyeon <sanxiyn@gmail.com>2014-01-23 01:55:53 +0900
commit7689353918aa2ba93b432bc96f2f6dca8665e7bc (patch)
tree89a4e74cffc1abce8a9fb7d8ea11af1ae044414d /src/libsyntax/parse
parent750d48b0ad1854b389ce1c209484f9146dc7aba0 (diff)
downloadrust-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.rs5
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();