From d50d48152998ca474329afd3c7cbf9bed29a6a4f Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Wed, 13 Oct 2010 10:55:20 -0700 Subject: [PATCH] rustc: Parse vector types --- src/comp/front/ast.rs | 1 + src/comp/front/parser.rs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs index a7ef4e65863..aa4ed1e771b 100644 --- a/src/comp/front/ast.rs +++ b/src/comp/front/ast.rs @@ -117,6 +117,7 @@ ty_char; ty_str; ty_box(@ty); + ty_vec(@ty); ty_tup(vec[tup(bool /* mutability */, @ty)]); ty_path(path, option[referent]); } diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs index 8d945dd8014..d731bf70305 100644 --- a/src/comp/front/parser.rs +++ b/src/comp/front/parser.rs @@ -107,6 +107,13 @@ fn spanned[T](&span lo, &span hi, &T node) -> ast.spanned[T] { case (token.AT) { p.bump(); t = ast.ty_box(parse_ty(p)); } + case (token.VEC) { + p.bump(); + expect(p, token.LBRACKET); + t = ast.ty_vec(parse_ty(p)); + expect(p, token.RBRACKET); + } + case (token.TUP) { p.bump(); auto f = parse_possibly_mutable_ty; // FIXME: trans_const_lval bug