diff options
| author | Kevin Ballard <kevin@sb.org> | 2013-12-04 13:08:42 -0800 |
|---|---|---|
| committer | Kevin Ballard <kevin@sb.org> | 2013-12-10 23:15:19 -0800 |
| commit | bd36b06f555a552b7a66fbc3bd749eb7226be4fa (patch) | |
| tree | 84b046b2c341996cfba1f1f275009794f529ca2a /src/libsyntax/parse/parser.rs | |
| parent | 4ab6a0856ff4ce59ae39ce067110446576ab227f (diff) | |
| download | rust-bd36b06f555a552b7a66fbc3bd749eb7226be4fa.tar.gz rust-bd36b06f555a552b7a66fbc3bd749eb7226be4fa.zip | |
Support imports of the form `use {foo,bar}`
This fixes #10806.
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 62bfd7c80f9..75d5cadca14 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4813,6 +4813,21 @@ impl Parser { fn parse_view_path(&self) -> @view_path { let lo = self.span.lo; + if *self.token == token::LBRACE { + // use {foo,bar} + let idents = self.parse_unspanned_seq( + &token::LBRACE, &token::RBRACE, + seq_sep_trailing_allowed(token::COMMA), + |p| p.parse_path_list_ident()); + let path = ast::Path { + span: mk_sp(lo, self.span.hi), + global: false, + segments: ~[] + }; + return @spanned(lo, self.span.hi, + view_path_list(path, idents, ast::DUMMY_NODE_ID)); + } + let first_ident = self.parse_ident(); let mut path = ~[first_ident]; debug!("parsed view_path: {}", self.id_to_str(first_ident)); |
