Add new variant to `named!` macro for extra parameters
diff --git a/synom/src/lib.rs b/synom/src/lib.rs
index 29f6e3d..e257b5d 100644
--- a/synom/src/lib.rs
+++ b/synom/src/lib.rs
@@ -156,6 +156,20 @@
$submac!(i, $($args)*)
}
};
+
+ // These two variants are for defining named parsers which have custom
+ // arguments, and are called with `call!()`
+ ($name:ident($($params:tt)*) -> $o:ty, $submac:ident!( $($args:tt)* )) => {
+ fn $name(i: $crate::Cursor, $($params)*) -> $crate::PResult<$o> {
+ $submac!(i, $($args)*)
+ }
+ };
+
+ (pub $name:ident($($params:tt)*) -> $o:ty, $submac:ident!( $($args:tt)* )) => {
+ pub fn $name(i: $crate::Cursor, $($params)*) -> $crate::PResult<$o> {
+ $submac!(i, $($args)*)
+ }
+ };
}
/// Invoke the given parser function with the passed in arguments.