diff options
| author | bors <bors@rust-lang.org> | 2014-08-27 06:01:18 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-08-27 06:01:18 +0000 |
| commit | 5550edef46ba7893b90d210913e3b37ffd77cae4 (patch) | |
| tree | 059588a2b627791b47bbba7712b253047263f585 /src/libsyntax/parse/parser.rs | |
| parent | 566b470e138e929e8a93d613372db1ba177c494f (diff) | |
| parent | c0e003d5ade810f36b8f4a1bb641b6bb2476b298 (diff) | |
| download | rust-5550edef46ba7893b90d210913e3b37ffd77cae4.tar.gz rust-5550edef46ba7893b90d210913e3b37ffd77cae4.zip | |
auto merge of #16689 : wickerwaka/rust/crate-as, r=pcwalton
For review. Not sure about the link_attrs stuff. Will work on converting all the tests. extern crate "foobar" as foo; extern crate foobar as foo; Implements remaining part of RFC #47. Addresses issue #16461. Removed link_attrs from rust.md, they don't appear to be supported by the parser.
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 01de001c043..816700681cf 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4807,7 +4807,8 @@ impl<'a> Parser<'a> { /// # Example /// /// extern crate url; - /// extern crate foo = "bar"; + /// extern crate foo = "bar"; //deprecated + /// extern crate "bar" as foo; fn parse_item_extern_crate(&mut self, lo: BytePos, visibility: Visibility, @@ -4818,6 +4819,8 @@ impl<'a> Parser<'a> { token::IDENT(..) => { let the_ident = self.parse_ident(); self.expect_one_of(&[], &[token::EQ, token::SEMI]); + // NOTE - #16689 change this to a warning once + // the 'as' support is in stage0 let path = if self.token == token::EQ { self.bump(); Some(self.parse_str()) @@ -4825,7 +4828,14 @@ impl<'a> Parser<'a> { self.expect(&token::SEMI); (path, the_ident) - } + }, + token::LIT_STR(..) | token::LIT_STR_RAW(..) => { + let path = self.parse_str(); + self.expect_keyword(keywords::As); + let the_ident = self.parse_ident(); + self.expect(&token::SEMI); + (Some(path), the_ident) + }, _ => { let span = self.span; let token_str = self.this_token_to_string(); |
