about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-03-22 11:21:48 -0700
committerbors <bors@rust-lang.org>2013-03-22 11:21:48 -0700
commitb6f9aa1fd75f0e9468b3bb9ee10a95d18c40b567 (patch)
treedd0e7abf8dea8cd6980a28062e1ae4459af84bc6 /src/libsyntax/parse
parentf011f928dd69a5b770b348aea2c547431c34e11a (diff)
parent94327d00c6a5329e510ae364850fa34cd758b83c (diff)
downloadrust-b6f9aa1fd75f0e9468b3bb9ee10a95d18c40b567.tar.gz
rust-b6f9aa1fd75f0e9468b3bb9ee10a95d18c40b567.zip
auto merge of #5483 : pcwalton/rust/static-syntax, r=graydon
r? @nikomatsakis 
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs77
1 files changed, 40 insertions, 37 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index e899c79a74c..07f8c8b743b 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2704,49 +2704,52 @@ pub impl Parser {
 
         let mut result = opt_vec::Empty;
         loop {
-            if self.eat(&token::BINOP(token::AND)) {
-                if self.eat_keyword(&~"static") {
-                    result.push(RegionTyParamBound);
-                } else {
-                    self.span_err(*self.span,
-                                  ~"`&static` is the only permissible \
-                                    region bound here");
+            match *self.token {
+                token::LIFETIME(lifetime) => {
+                    if str::eq_slice(*self.id_to_str(lifetime), "static") {
+                        result.push(RegionTyParamBound);
+                    } else {
+                        self.span_err(*self.span,
+                                      ~"`'static` is the only permissible \
+                                        region bound here");
+                    }
+                    self.bump();
                 }
-            } else if is_ident(&*self.token) {
-                let maybe_bound = match *self.token {
-                    token::IDENT(copy sid, _) => {
-                        match *self.id_to_str(sid) {
-                            ~"send" |
-                            ~"copy" |
-                            ~"const" |
-                            ~"owned" => {
-                                self.obsolete(
-                                    *self.span,
-                                    ObsoleteLowerCaseKindBounds);
-
-                                // Bogus value, but doesn't matter, since
-                                // is an error
-                                Some(TraitTyParamBound(
-                                    self.mk_ty_path(sid)))
+                token::IDENT(*) => {
+                    let maybe_bound = match *self.token {
+                        token::IDENT(copy sid, _) => {
+                            match *self.id_to_str(sid) {
+                                ~"send" |
+                                ~"copy" |
+                                ~"const" |
+                                ~"owned" => {
+                                    self.obsolete(
+                                        *self.span,
+                                        ObsoleteLowerCaseKindBounds);
+
+                                    // Bogus value, but doesn't matter, since
+                                    // is an error
+                                    Some(TraitTyParamBound(
+                                        self.mk_ty_path(sid)))
+                                }
+                                _ => None
                             }
-                            _ => None
                         }
-                    }
-                    _ => fail!()
-                };
+                        _ => fail!()
+                    };
 
-                match maybe_bound {
-                    Some(bound) => {
-                        self.bump();
-                        result.push(bound);
-                    }
-                    None => {
-                        let ty = self.parse_ty(false);
-                        result.push(TraitTyParamBound(ty));
+                    match maybe_bound {
+                        Some(bound) => {
+                            self.bump();
+                            result.push(bound);
+                        }
+                        None => {
+                            let ty = self.parse_ty(false);
+                            result.push(TraitTyParamBound(ty));
+                        }
                     }
                 }
-            } else {
-                break;
+                _ => break,
             }
 
             if self.eat(&token::BINOP(token::PLUS)) {