diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-03-19 15:40:04 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-03-19 15:40:04 -0700 |
| commit | b0bea108983446aaa33ecabdd44954e03d5c65e0 (patch) | |
| tree | feb98d4633c9ed28082fbb1d41b4b1451dae868c /src/libsyntax/parse/parser.rs | |
| parent | 049e1f9a1f60cfbc4136bd8496737e707ca05a42 (diff) | |
| download | rust-b0bea108983446aaa33ecabdd44954e03d5c65e0.tar.gz rust-b0bea108983446aaa33ecabdd44954e03d5c65e0.zip | |
libsyntax: Accept the new `[T, ..N]` style for vec.
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index b224ccba114..40ef0bcc99e 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -642,9 +642,9 @@ pub impl Parser { self.obsolete(*self.last_span, ObsoleteMutVector); } - // Parse the `* e` in `[ int * e ]` + // Parse the `, ..e` in `[ int, ..e ]` // where `e` is a const expression - let t = match self.maybe_parse_fixed_vstore_with_star() { + let t = match self.maybe_parse_fixed_vstore() { None => ty_vec(mt), Some(suffix) => ty_fixed_length_vec(mt, suffix) }; @@ -815,8 +815,14 @@ pub impl Parser { }) } - fn maybe_parse_fixed_vstore_with_star(&self) -> Option<@ast::expr> { + fn maybe_parse_fixed_vstore(&self) -> Option<@ast::expr> { if self.eat(&token::BINOP(token::STAR)) { + // XXX: Obsolete; remove after snapshot. + Some(self.parse_expr()) + } else if *self.token == token::COMMA && + self.look_ahead(1) == token::DOTDOT { + self.bump(); + self.bump(); Some(self.parse_expr()) } else { None |
