Feature flag for nom dependency
diff --git a/Cargo.toml b/Cargo.toml
index bd98bc8..38351cd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,5 +7,9 @@
 repository = "https://github.com/dtolnay/item"
 include = ["Cargo.toml", "src/**/*.rs"]
 
+[features]
+default = ["parsing"]
+parsing = ["nom"]
+
 [dependencies]
-nom = "1.2.4"
+nom = { version = "1.2.4", optional = true }
diff --git a/src/attr.rs b/src/attr.rs
index 266bbb4..571cf09 100644
--- a/src/attr.rs
+++ b/src/attr.rs
@@ -1,7 +1,10 @@
 use super::*;
 
+#[cfg(feature = "parsing")]
 use common::word;
+#[cfg(feature = "parsing")]
 use helper::escaped_string;
+#[cfg(feature = "parsing")]
 use nom::multispace;
 
 #[derive(Debug, Clone, Eq, PartialEq)]
@@ -29,6 +32,7 @@
     NameValue(Ident, String),
 }
 
+#[cfg(feature = "parsing")]
 named!(pub attribute<&str, Attribute>, alt!(
     do_parse!(
         punct!("#") >>
@@ -55,12 +59,14 @@
     )
 ));
 
+#[cfg(feature = "parsing")]
 named!(quoted<&str, String>, delimited!(
     punct!("\""),
     escaped_string,
     tag_s!("\"")
 ));
 
+#[cfg(feature = "parsing")]
 named!(meta_item<&str, MetaItem>, alt!(
     do_parse!(
         ident: word >>
diff --git a/src/common.rs b/src/common.rs
index 3cd8587..b24e9ee 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -6,15 +6,18 @@
     Inherited,
 }
 
+#[cfg(feature = "parsing")]
 fn ident_ch(ch: char) -> bool {
     ch.is_alphanumeric() || ch == '_'
 }
 
+#[cfg(feature = "parsing")]
 named!(pub word<&str, Ident>, preceded!(
     opt!(call!(::nom::multispace)),
     map!(take_while1_s!(ident_ch), String::from)
 ));
 
+#[cfg(feature = "parsing")]
 named!(pub visibility<&str, Visibility>, preceded!(
     opt!(call!(::nom::multispace)),
     alt!(
diff --git a/src/generics.rs b/src/generics.rs
index 425228d..d1e889c 100644
--- a/src/generics.rs
+++ b/src/generics.rs
@@ -1,7 +1,10 @@
 use super::*;
 
+#[cfg(feature = "parsing")]
 use common::word;
+#[cfg(feature = "parsing")]
 use ty::{ty, poly_trait_ref};
+#[cfg(feature = "parsing")]
 use nom::multispace;
 
 #[derive(Debug, Clone, Eq, PartialEq, Default)]
@@ -67,6 +70,7 @@
     pub bounds: Vec<Lifetime>,
 }
 
+#[cfg(feature = "parsing")]
 named!(pub generics<&str, Generics>, do_parse!(
     bracketed: alt!(
         do_parse!(
@@ -96,11 +100,13 @@
     })
 ));
 
+#[cfg(feature = "parsing")]
 named!(pub lifetime<&str, Lifetime>, preceded!(
     punct!("'"),
     map!(word, |ident| Lifetime { ident: ident })
 ));
 
+#[cfg(feature = "parsing")]
 named!(pub lifetime_def<&str, LifetimeDef>, do_parse!(
     life: lifetime >>
     bounds: opt_vec!(preceded!(
@@ -113,6 +119,7 @@
     })
 ));
 
+#[cfg(feature = "parsing")]
 named!(pub bound_lifetimes<&str, Vec<LifetimeDef> >, opt_vec!(do_parse!(
     punct!("for") >>
     punct!("<") >>
@@ -121,6 +128,7 @@
     (lifetimes)
 )));
 
+#[cfg(feature = "parsing")]
 named!(ty_param<&str, TyParam>, do_parse!(
     ident: word >>
     bounds: opt_vec!(preceded!(
@@ -138,6 +146,7 @@
     })
 ));
 
+#[cfg(feature = "parsing")]
 named!(pub ty_param_bound<&str, TyParamBound>, alt!(
     tuple!(punct!("?"), punct!("Sized")) => { |_| TyParamBound::MaybeSized }
     |
@@ -146,6 +155,7 @@
     poly_trait_ref => { TyParamBound::Trait }
 ));
 
+#[cfg(feature = "parsing")]
 named!(where_predicate<&str, WherePredicate>, alt!(
     do_parse!(
         ident: lifetime >>
diff --git a/src/helper.rs b/src/helper.rs
index 5299cc4..6c9f6e2 100644
--- a/src/helper.rs
+++ b/src/helper.rs
@@ -1,3 +1,5 @@
+#![cfg(feature = "parsing")]
+
 use nom::{self, IResult};
 
 macro_rules! punct {
diff --git a/src/item.rs b/src/item.rs
index 544b55f..eb40ae0 100644
--- a/src/item.rs
+++ b/src/item.rs
@@ -1,9 +1,14 @@
 use super::*;
 
+#[cfg(feature = "parsing")]
 use attr::attribute;
+#[cfg(feature = "parsing")]
 use common::{word, visibility};
+#[cfg(feature = "parsing")]
 use generics::generics;
+#[cfg(feature = "parsing")]
 use ty::ty;
+#[cfg(feature = "parsing")]
 use nom::multispace;
 
 #[derive(Debug, Clone, Eq, PartialEq)]
@@ -44,6 +49,7 @@
     pub ty: Ty,
 }
 
+#[cfg(feature = "parsing")]
 named!(pub item<&str, Item>, do_parse!(
     attrs: many0!(attribute) >>
     vis: visibility >>
@@ -72,6 +78,7 @@
     (item)
 ));
 
+#[cfg(feature = "parsing")]
 named!(struct_body<&str, (Style, Vec<Field>)>, alt!(
     struct_like_body => { |fields| (Style::Struct, fields) }
     |
@@ -80,6 +87,7 @@
     punct!(";") => { |_| (Style::Unit, Vec::new()) }
 ));
 
+#[cfg(feature = "parsing")]
 named!(enum_body<&str, Body>, do_parse!(
     punct!("{") >>
     variants: separated_list!(punct!(","), variant) >>
@@ -88,6 +96,7 @@
     (Body::Enum(variants))
 ));
 
+#[cfg(feature = "parsing")]
 named!(variant<&str, Variant>, do_parse!(
     attrs: many0!(attribute) >>
     ident: word >>
@@ -106,6 +115,7 @@
     })
 ));
 
+#[cfg(feature = "parsing")]
 named!(struct_like_body<&str, Vec<Field> >, do_parse!(
     punct!("{") >>
     fields: separated_list!(punct!(","), struct_field) >>
@@ -114,6 +124,7 @@
     (fields)
 ));
 
+#[cfg(feature = "parsing")]
 named!(tuple_like_body<&str, Vec<Field> >, do_parse!(
     punct!("(") >>
     fields: separated_list!(punct!(","), tuple_field) >>
@@ -122,6 +133,7 @@
     (fields)
 ));
 
+#[cfg(feature = "parsing")]
 named!(struct_field<&str, Field>, do_parse!(
     attrs: many0!(attribute) >>
     vis: visibility >>
@@ -136,6 +148,7 @@
     })
 ));
 
+#[cfg(feature = "parsing")]
 named!(tuple_field<&str, Field>, do_parse!(
     attrs: many0!(attribute) >>
     vis: visibility >>
diff --git a/src/lib.rs b/src/lib.rs
index ebd3c8e..7b813cb 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,6 +1,8 @@
+#[cfg(feature = "parsing")]
 #[macro_use]
 extern crate nom;
 
+#[cfg(feature = "parsing")]
 #[macro_use]
 mod do_parse;
 
@@ -59,6 +61,7 @@
     TypeBinding,
 };
 
+#[cfg(feature = "parsing")]
 pub fn parse(input: &str) -> Item {
     match item::item(input) {
         nom::IResult::Done(rest, ast) => {
@@ -73,6 +76,7 @@
     }
 }
 
+#[cfg(feature = "parsing")]
 fn raise(mut err: nom::Err<&str>) -> ! {
     loop {
         match err {
diff --git a/src/ty.rs b/src/ty.rs
index a875422..b364c8e 100644
--- a/src/ty.rs
+++ b/src/ty.rs
@@ -1,9 +1,13 @@
 use super::*;
 
+#[cfg(feature = "parsing")]
 use common::word;
+#[cfg(feature = "parsing")]
 use generics::{lifetime, lifetime_def, ty_param_bound, bound_lifetimes};
+#[cfg(feature = "parsing")]
 use nom::{digit, multispace};
 
+#[cfg(feature = "parsing")]
 use std::str;
 
 #[derive(Debug, Clone, Eq, PartialEq)]
@@ -186,6 +190,7 @@
     Ty(Ty),
 }
 
+#[cfg(feature = "parsing")]
 named!(pub ty<&str, Ty>, alt!(
     ty_vec
     |
@@ -210,6 +215,7 @@
     ty_paren
 ));
 
+#[cfg(feature = "parsing")]
 named!(ty_vec<&str, Ty>, do_parse!(
     punct!("[") >>
     elem: ty >>
@@ -217,6 +223,7 @@
     (Ty::Vec(Box::new(elem)))
 ));
 
+#[cfg(feature = "parsing")]
 named!(ty_fixed_length_vec<&str, Ty>, do_parse!(
     punct!("[") >>
     elem: ty >>
@@ -226,6 +233,7 @@
     (Ty::FixedLengthVec(Box::new(elem), size))
 ));
 
+#[cfg(feature = "parsing")]
 named!(ty_ptr<&str, Ty>, do_parse!(
     punct!("*") >>
     mutability: alt!(
@@ -240,6 +248,7 @@
     })))
 ));
 
+#[cfg(feature = "parsing")]
 named!(ty_rptr<&str, Ty>, do_parse!(
     punct!("&") >>
     life: opt!(lifetime) >>
@@ -251,6 +260,7 @@
     })))
 ));
 
+#[cfg(feature = "parsing")]
 named!(ty_bare_fn<&str, Ty>, do_parse!(
     punct!("fn") >>
     multispace >>
@@ -278,8 +288,10 @@
     })))
 ));
 
+#[cfg(feature = "parsing")]
 named!(ty_never<&str, Ty>, map!(punct!("!"), |_| Ty::Never));
 
+#[cfg(feature = "parsing")]
 named!(ty_tup<&str, Ty>, do_parse!(
     punct!("(") >>
     elems: separated_list!(punct!(","), ty) >>
@@ -287,8 +299,10 @@
     (Ty::Tup(elems))
 ));
 
+#[cfg(feature = "parsing")]
 named!(ty_path<&str, Ty>, map!(path, |p| Ty::Path(None, p)));
 
+#[cfg(feature = "parsing")]
 named!(ty_qpath<&str, Ty>, do_parse!(
     punct!("<") >>
     this: map!(ty, Box::new) >>
@@ -316,6 +330,7 @@
     })
 ));
 
+#[cfg(feature = "parsing")]
 named!(ty_impl_trait<&str, Ty>, do_parse!(
     punct!("impl") >>
     multispace >>
@@ -323,6 +338,7 @@
     (Ty::ImplTrait(elem))
 ));
 
+#[cfg(feature = "parsing")]
 named!(ty_paren<&str, Ty>, do_parse!(
     punct!("(") >>
     elem: ty >>
@@ -330,6 +346,7 @@
     (Ty::Paren(Box::new(elem)))
 ));
 
+#[cfg(feature = "parsing")]
 named!(mutability<&str, Mutability>, preceded!(
     opt!(multispace),
     alt!(
@@ -339,6 +356,7 @@
     )
 ));
 
+#[cfg(feature = "parsing")]
 named!(path<&str, Path>, do_parse!(
     global: opt!(punct!("::")) >>
     segments: separated_nonempty_list!(punct!("::"), path_segment) >>
@@ -348,6 +366,7 @@
     })
 ));
 
+#[cfg(feature = "parsing")]
 named!(path_segment<&str, PathSegment>, alt!(
     do_parse!(
         ident: word >>
@@ -380,6 +399,7 @@
     map!(word, PathSegment::ident)
 ));
 
+#[cfg(feature = "parsing")]
 named!(type_binding<&str, TypeBinding>, do_parse!(
     ident: word >>
     punct!("=") >>
@@ -390,6 +410,7 @@
     })
 ));
 
+#[cfg(feature = "parsing")]
 named!(pub poly_trait_ref<&str, PolyTraitRef>, do_parse!(
     bound_lifetimes: bound_lifetimes >>
     trait_ref: path >>
@@ -399,6 +420,7 @@
     })
 ));
 
+#[cfg(feature = "parsing")]
 named!(fn_arg<&str, Arg>, do_parse!(
     pat: opt!(terminated!(word, punct!(":"))) >>
     ty: ty >>