about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2012-08-13 16:06:21 -0700
committerPatrick Walton <pcwalton@mimiga.net>2012-08-13 16:07:12 -0700
commit87f4c153110743844e4b3a4bb9dcde31a5ef3eb4 (patch)
tree527389e5547b3e42a27dcf209d6ac6cf3d8ff6fe /src/libsyntax/parse
parentc7ed9908d6023a278b2a53711abea50d186b71bc (diff)
downloadrust-87f4c153110743844e4b3a4bb9dcde31a5ef3eb4.tar.gz
rust-87f4c153110743844e4b3a4bb9dcde31a5ef3eb4.zip
rustc: Make functional record and struct update use ".." instead of "with".
"with" is still accepted for backwards compatibility.
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index fbfd5aa6634..6ea5596fa2c 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -928,7 +928,8 @@ class parser {
                             !self.is_keyword(~"with") {
                         self.expect(token::COMMA);
                         if self.token == token::RBRACE ||
-                                self.is_keyword(~"with") {
+                                self.is_keyword(~"with") ||
+                                self.token == token::DOTDOT {
                             // Accept an optional trailing comma.
                             break;
                         }
@@ -936,7 +937,7 @@ class parser {
                     }
 
                     let base;
-                    if self.eat_keyword(~"with") {
+                    if self.eat_keyword(~"with") || self.eat(token::DOTDOT) {
                         base = some(self.parse_expr());
                     } else {
                         base = none;
@@ -1548,6 +1549,16 @@ class parser {
         let mut fields = ~[self.parse_field(token::COLON)];
         let mut base = none;
         while self.token != token::RBRACE {
+            if self.token == token::COMMA
+                && self.look_ahead(1) == token::DOTDOT {
+                self.bump();
+                self.bump();
+                base = some(self.parse_expr()); break;
+            }
+
+            // XXX: Remove "with" after all code is converted over and there's
+            // a snapshot.
+
             // optional comma before "with"
             if self.token == token::COMMA
                 && self.token_is_keyword(~"with",