Skip to content

Commit

Permalink
add variants to named_args
Browse files Browse the repository at this point in the history
  • Loading branch information
Geal committed Oct 30, 2017
1 parent cf171a2 commit 54ee6ff
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,16 @@ macro_rules! named_args {
$submac!(input, $($args)*)
}
};
(pub $func_name:ident ( $( $arg:ident : $typ:ty ),* ) < $input_type:ty, $return_type:ty > , $submac:ident!( $($args:tt)* ) ) => {
pub fn $func_name(input: $input_type, $( $arg : $typ ),*) -> $crate::IResult<$input_type, $return_type> {
$submac!(input, $($args)*)
}
};
($func_name:ident ( $( $arg:ident : $typ:ty ),* ) < $input_type:ty, $return_type:ty > , $submac:ident!( $($args:tt)* ) ) => {
fn $func_name(input: $input_type, $( $arg : $typ ),*) -> $crate::IResult<$input_type, $return_type> {
$submac!(input, $($args)*)
}
};
}

/// Makes a function from a parser combination, with attributes
Expand Down

0 comments on commit 54ee6ff

Please sign in to comment.