about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorMurarth <murarth@gmail.com>2014-11-17 14:36:27 -0700
committerMurarth <murarth@gmail.com>2014-11-17 20:26:21 -0700
commit7ef200774fbb8e5f4961f63a83cf5bbe27cd5f8f (patch)
treebe53283f1d658cca59bc8f832691e6dae6eeca07 /src/libsyntax/parse/parser.rs
parent9c96a79a74f10bed18b031ce0ac4126c56d6cfb3 (diff)
downloadrust-7ef200774fbb8e5f4961f63a83cf5bbe27cd5f8f.tar.gz
rust-7ef200774fbb8e5f4961f63a83cf5bbe27cd5f8f.zip
libsyntax: Add `parse_view_item` method to Parser
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 98479d65cbb..9d6dece34da 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -5609,6 +5609,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());