Fix doctests and macros
diff --git a/src/parsers.rs b/src/parsers.rs
index 7691074..ebe229c 100644
--- a/src/parsers.rs
+++ b/src/parsers.rs
@@ -217,7 +217,7 @@
/// #[macro_use]
/// extern crate syn;
///
-/// use syn::{Expr, Ident};
+/// use syn::Expr;
///
/// /// Parses any expression that does not begin with a `-` minus sign.
/// named!(not_negative_expr -> Expr, do_parse!(
@@ -251,8 +251,10 @@
/// ```rust
/// #[macro_use]
/// extern crate syn;
+/// extern crate proc_macro2;
///
-/// use syn::{Ident, MacroDelimiter};
+/// use proc_macro2::Ident;
+/// use syn::MacroDelimiter;
/// use syn::token::{Paren, Bracket, Brace};
/// use syn::synom::Synom;
///
@@ -416,8 +418,10 @@
/// ```rust
/// #[macro_use]
/// extern crate syn;
+/// extern crate proc_macro2;
///
-/// use syn::{Ident, Item};
+/// use proc_macro2::Ident;
+/// use syn::Item;
/// use syn::token::Brace;
/// use syn::synom::Synom;
///
@@ -526,8 +530,9 @@
/// ```rust
/// #[macro_use]
/// extern crate syn;
+/// extern crate proc_macro2;
///
-/// use syn::Ident;
+/// use proc_macro2::Ident;
/// use syn::token::Brace;
/// use syn::synom::Synom;
///
@@ -620,8 +625,9 @@
/// ```rust
/// #[macro_use]
/// extern crate syn;
+/// extern crate proc_macro2;
///
-/// use syn::Ident;
+/// use proc_macro2::Ident;
/// use syn::token::Brace;
/// use syn::synom::Synom;
///
@@ -811,15 +817,16 @@
/// ```rust
/// #[macro_use]
/// extern crate syn;
+/// extern crate proc_macro2;
///
-/// use syn::Ident;
+/// use proc_macro2::{Ident, Span};
///
/// // Parse any identifier token, or the `!` token in which case the
/// // identifier is treated as `"BANG"`.
/// named!(ident_or_bang -> Ident, alt!(
/// syn!(Ident)
/// |
-/// punct!(!) => { |_| "BANG".into() }
+/// punct!(!) => { |_| Ident::new("BANG", Span::call_site()) }
/// ));
/// #
/// # fn main() {}
@@ -926,10 +933,10 @@
/// extern crate syn;
/// extern crate proc_macro2;
///
-/// use syn::Ident;
+/// use proc_macro2::Ident;
+/// use proc_macro2::TokenStream;
/// use syn::token::Paren;
/// use syn::synom::Synom;
-/// use proc_macro2::TokenStream;
///
/// /// Parse a macro invocation that uses `(` `)` parentheses.
/// ///
@@ -1222,8 +1229,10 @@
/// ```rust
/// #[macro_use]
/// extern crate syn;
+/// extern crate proc_macro2;
///
-/// use syn::{Ident, Item};
+/// use proc_macro2::Ident;
+/// use syn::Item;
/// use syn::token::Brace;
/// use syn::synom::Synom;
///
@@ -1275,8 +1284,9 @@
/// ```rust
/// #[macro_use]
/// extern crate syn;
+/// extern crate proc_macro2;
///
-/// use syn::Ident;
+/// use proc_macro2::Ident;
/// use syn::synom::Synom;
///
/// struct Flag {
@@ -1301,10 +1311,14 @@
#[macro_export]
macro_rules! custom_keyword {
($i:expr, $keyword:ident) => {
- match <$crate::Ident as $crate::synom::Synom>::parse($i) {
+ match <
+ $crate::parsers::__custom_keyword_inner::Ident
+ as
+ $crate::synom::Synom
+ >::parse($i) {
::std::result::Result::Err(err) => ::std::result::Result::Err(err),
::std::result::Result::Ok((token, i)) => {
- if token == stringify!($keyword) {
+ if token.to_string() == stringify!($keyword) {
::std::result::Result::Ok((token, i))
} else {
$crate::parse_error()
@@ -1314,6 +1328,11 @@
};
}
+#[doc(hidden)]
+pub mod __custom_keyword_inner {
+ pub use proc_macro2::Ident;
+}
+
/// Parse inside of `(` `)` parentheses.
///
/// This macro parses a set of balanced parentheses and invokes a sub-parser on