about summary refs log tree commit diff
path: root/src/comp/syntax
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-09-20 16:07:09 -0700
committerBrian Anderson <banderson@mozilla.com>2011-09-20 17:51:17 -0700
commit865dcb663da2d0534d508346cbe1df5dc66f3ad6 (patch)
tree8e4af2aee695b380631be9887ac36f00aacbf864 /src/comp/syntax
parentbe1feaa9187ca75c867b04283c2bea1128c344d5 (diff)
Parse unique box types
Issue #409
Diffstat (limited to 'src/comp/syntax')
-rw-r--r--src/comp/syntax/ast.rs1
-rw-r--r--src/comp/syntax/parse/parser.rs5
-rw-r--r--src/comp/syntax/print/pprust.rs1
-rw-r--r--src/comp/syntax/visit.rs1
4 files changed, 8 insertions, 0 deletions
diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs
index 5a34d1a4c16..6b64d373746 100644
--- a/src/comp/syntax/ast.rs
+++ b/src/comp/syntax/ast.rs
@@ -307,6 +307,7 @@ tag ty_ {
     ty_char;
     ty_str;
     ty_box(mt);
+    ty_uniq(mt);
     ty_vec(mt);
     ty_ptr(mt);
     ty_task;
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
index 1d84ed148b1..3e559e1a2a9 100644
--- a/src/comp/syntax/parse/parser.rs
+++ b/src/comp/syntax/parse/parser.rs
@@ -540,6 +540,11 @@ fn parse_ty(p: parser, colons_before_params: bool) -> @ast::ty {
         let mt = parse_mt(p);
         hi = mt.ty.span.hi;
         t = ast::ty_box(mt);
+    } else if p.peek() == token::TILDE {
+        p.bump();
+        let mt = parse_mt(p);
+        hi = mt.ty.span.hi;
+        t = ast::ty_uniq(mt);
     } else if p.peek() == token::BINOP(token::STAR) {
         p.bump();
         let mt = parse_mt(p);
diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs
index 159a70509c4..3a8e5f2b9be 100644
--- a/src/comp/syntax/print/pprust.rs
+++ b/src/comp/syntax/print/pprust.rs
@@ -260,6 +260,7 @@ fn print_type(s: ps, ty: @ast::ty) {
       ast::ty_char. { word(s.s, "char"); }
       ast::ty_str. { word(s.s, "str"); }
       ast::ty_box(mt) { word(s.s, "@"); print_mt(s, mt); }
+      ast::ty_uniq(mt) { word(s.s, "~"); print_mt(s, mt); }
       ast::ty_vec(mt) {
         word(s.s, "[");
         alt mt.mut {
diff --git a/src/comp/syntax/visit.rs b/src/comp/syntax/visit.rs
index 386f5564781..d5b39bb7ca5 100644
--- a/src/comp/syntax/visit.rs
+++ b/src/comp/syntax/visit.rs
@@ -121,6 +121,7 @@ fn visit_ty<E>(t: @ty, e: E, v: vt<E>) {
       ty_char. {/* no-op */ }
       ty_str. {/* no-op */ }
       ty_box(mt) { v.visit_ty(mt.ty, e, v); }
+      ty_uniq(mt) { v.visit_ty(mt.ty, e, v); }
       ty_vec(mt) { v.visit_ty(mt.ty, e, v); }
       ty_ptr(mt) { v.visit_ty(mt.ty, e, v); }
       ty_port(t) { v.visit_ty(t, e, v); }