auto merge of #19044 : murarth/rust/libsyntax-view-item, r=alexcrichton

Allows parsing view items (`use` and `extern crate`) individually. Does not change behavior of any existing functions.

Closes #19024
This commit is contained in:
bors 2014-11-18 23:51:43 +00:00
commit e09d98603e
3 changed files with 41 additions and 1 deletions

View file

@ -5620,6 +5620,14 @@ impl<'a> Parser<'a> {
}
}
/// Parse a ViewItem, e.g. `use foo::bar` or `extern crate foo`
pub fn parse_view_item(&mut self, attrs: Vec<Attribute>) -> ViewItem {
match self.parse_item_or_view_item(attrs, false) {
IoviViewItem(vi) => vi,
_ => self.fatal("expected `use` or `extern crate`"),
}
}
/// Parse, e.g., "use a::b::{z,y}"
fn parse_use(&mut self) -> ViewItem_ {
return ViewItemUse(self.parse_view_path());