about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-12-15 10:46:28 -0800
committerbors <bors@rust-lang.org>2013-12-15 10:46:28 -0800
commitebbd30b5b2699c3f16a3387ed0851a2831076295 (patch)
treee95f52a85ab4a64e0ac858bf4546d673de513f95 /src/libsyntax/parse
parent8d52dfbace05c46754f4f6bb5a25f55906c9d7b0 (diff)
parent998a3bbae0c3d998edb7c3e36173c844492010a5 (diff)
downloadrust-ebbd30b5b2699c3f16a3387ed0851a2831076295.tar.gz
rust-ebbd30b5b2699c3f16a3387ed0851a2831076295.zip
auto merge of #10929 : pcwalton/rust/deboxing, r=pcwalton
...eyword.

r? @brson
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs16
-rw-r--r--src/libsyntax/parse/token.rs16
2 files changed, 25 insertions, 7 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index aa37d859d79..33e3bae99a7 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2326,6 +2326,22 @@ impl Parser {
               _ => self.mk_unary(UnUniq, e)
             };
           }
+          token::IDENT(_, _) if self.is_keyword(keywords::Box) => {
+            self.bump();
+
+            let subexpression = self.parse_prefix_expr();
+            hi = subexpression.span.hi;
+            // HACK: turn `box [...]` into a boxed-evec
+            ex = match subexpression.node {
+                ExprVec(..) |
+                ExprLit(@codemap::Spanned {
+                    node: lit_str(..),
+                    span: _
+                }) |
+                ExprRepeat(..) => ExprVstore(subexpression, ExprVstoreUniq),
+                _ => self.mk_unary(UnUniq, subexpression)
+            };
+          }
           _ => return self.parse_dot_or_call_expr()
         }
         return self.mk_expr(lo, hi, ex);
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index a49f423c408..9e1eec19b2c 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -465,15 +465,17 @@ declare_special_idents_and_keywords! {
         (45,                         While,      "while");
         (46,                         Continue,   "continue");
         (47,                         Proc,       "proc");
+        (48,                         Box,        "box");
 
         'reserved:
-        (48,                         Alignof,    "alignof");
-        (49,                         Be,         "be");
-        (50,                         Offsetof,   "offsetof");
-        (51,                         Pure,       "pure");
-        (52,                         Sizeof,     "sizeof");
-        (53,                         Typeof,     "typeof");
-        (54,                         Yield,      "yield");
+        (49,                         Alignof,    "alignof");
+        (50,                         Be,         "be");
+        (51,                         Offsetof,   "offsetof");
+        (52,                         Pure,       "pure");
+        (53,                         Sizeof,     "sizeof");
+        (54,                         Typeof,     "typeof");
+        (55,                         Unsized,    "unsized");
+        (56,                         Yield,      "yield");
     }
 }