about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-05-02 17:21:36 -0700
committerPatrick Walton <pcwalton@mimiga.net>2014-05-02 18:31:16 -0700
commit80b43de5ab1bb063a1d1eaab64dd0389c4443541 (patch)
treebc83a52fdac57ebce5e6dce33c8bdab349d11ca6 /src/libsyntax/parse/parser.rs
parentb5d6b07370b665df6b54fa20e971e61041a233b0 (diff)
downloadrust-80b43de5ab1bb063a1d1eaab64dd0389c4443541.tar.gz
rust-80b43de5ab1bb063a1d1eaab64dd0389c4443541.zip
libsyntax: Add `box PAT` to the pattern grammar. RFC #14.
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 5d8443b64d5..eefb496c943 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2867,6 +2867,19 @@ impl<'a> Parser<'a> {
             // parse ref pat
             let mutbl = self.parse_mutability();
             pat = self.parse_pat_ident(BindByRef(mutbl));
+        } else if self.eat_keyword(keywords::Box) {
+            // `box PAT`
+            //
+            // FIXME(#13910): Rename to `PatBox` and extend to full DST
+            // support.
+            let sub = self.parse_pat();
+            pat = PatUniq(sub);
+            hi = self.last_span.hi;
+            return @ast::Pat {
+                id: ast::DUMMY_NODE_ID,
+                node: pat,
+                span: mk_sp(lo, hi)
+            }
         } else {
             let can_be_enum_or_struct = self.look_ahead(1, |t| {
                 match *t {