Allow cond_reduce without a sub parser
diff --git a/src/parsers.rs b/src/parsers.rs
index e2af5f2..de6c168 100644
--- a/src/parsers.rs
+++ b/src/parsers.rs
@@ -328,6 +328,13 @@
/// - **Syntax:** `cond_reduce!(CONDITION, THING)`
/// - **Output:** `THING`
///
+/// The subparser may be omitted in which case it defaults to [`epsilon!`].
+///
+/// [`epsilon!`]: macro.epsilon.html
+///
+/// - **Syntax:** `cond_reduce!(CONDITION)`
+/// - **Output:** `()`
+///
/// ```rust
/// #[macro_use]
/// extern crate syn;
@@ -385,6 +392,10 @@
}
};
+ ($i:expr, $cond:expr) => {
+ cond_reduce!($i, $cond, epsilon!())
+ };
+
($i:expr, $cond:expr, $f:expr) => {
cond_reduce!($i, $cond, call!($f))
};