missing named_args alternatives

This commit is contained in:
Geoffroy Couprie 2018-01-13 16:41:23 +01:00
parent 7d14e5bf6c
commit f2d658ed2f

View File

@ -188,6 +188,22 @@ macro_rules! named_args {
$submac!(input, $($args)*)
}
};
(pub $func_name:ident < 'a > ( $( $arg:ident : $typ:ty ),* ) < $input_type:ty, $return_type:ty > , $submac:ident!( $($args:tt)* ) ) => {
fn $func_name<'a>(
input: $input_type, $( $arg : $typ ),*)
-> $crate::IResult<$input_type, $return_type>
{
$submac!(input, $($args)*)
}
};
($func_name:ident < 'a > ( $( $arg:ident : $typ:ty ),* ) < $input_type:ty, $return_type:ty > , $submac:ident!( $($args:tt)* ) ) => {
fn $func_name<'a>(
input: $input_type, $( $arg : $typ ),*)
-> $crate::IResult<$input_type, $return_type>
{
$submac!(input, $($args)*)
}
};
}
/// Makes a function from a parser combination, with attributes