commit | 4c614be4df02b18b93df9b3e64a65cb98da6367c | [log] [tgz] |
---|---|---|
author | David Tolnay <dtolnay@gmail.com> | Fri Nov 10 00:02:38 2017 -0800 |
committer | David Tolnay <dtolnay@gmail.com> | Fri Nov 10 10:09:38 2017 -0800 |
tree | 39f5db3a1e7a2c572405121df9ca8206f55e9957 | |
parent | aee2d284168470958c93ccdb094b7bcbb4b499fb [diff] [blame] |
Expose Synom impls for each kind of Item
diff --git a/src/macros.rs b/src/macros.rs index 69a405e..ae424f9 100644 --- a/src/macros.rs +++ b/src/macros.rs
@@ -129,3 +129,16 @@ ($($rest:tt)*) => (ast_struct! { $($rest)* }); } + +#[cfg(all(feature = "full", feature = "parsing"))] +macro_rules! impl_synom { + ($t:ident $description:tt $($parser:tt)+) => { + impl Synom for $t { + named!(parse -> Self, $($parser)+); + + fn description() -> Option<&'static str> { + Some($description) + } + } + } +}