Macro python_ast::tk_named
[−]
[src]
macro_rules! tk_named { (#$($args:tt)*) => { ... }; ($name:ident( $i:ty ) -> $o:ty, $submac:ident!( $($args:tt)* )) => { ... }; ($name:ident<$i:ty,$o:ty,$e:ty>, $submac:ident!( $($args:tt)* )) => { ... }; ($name:ident<$i:ty,$o:ty>, $submac:ident!( $($args:tt)* )) => { ... }; ($name:ident<$o:ty>, $submac:ident!( $($args:tt)* )) => { ... }; ($name:ident, $submac:ident!( $($args:tt)* )) => { ... }; (pub $name:ident( $i:ty ) -> $o:ty, $submac:ident!( $($args:tt)* )) => { ... }; (pub $name:ident<$i:ty,$o:ty,$e:ty>, $submac:ident!( $($args:tt)* )) => { ... }; (pub $name:ident<$i:ty,$o:ty>, $submac:ident!( $($args:tt)* )) => { ... }; (pub $name:ident<$o:ty>, $submac:ident!( $($args:tt)* )) => { ... }; (pub $name:ident, $submac:ident!( $($args:tt)* )) => { ... }; }
Makes a function from a parser combination
The type can be set up if the compiler needs more information
named!(my_function( TkSlice<'a> ) -> TkSlice<'a>, tag!("abcd")); // first type parameter is input, second is output named!(my_function<TkSlice<'a>, TkSlice<'a>>, tag!("abcd")); // will have TkSlice<'a> as input type, TkSlice<'a> as output type named!(my_function, tag!("abcd")); // will use TkSlice<'a> as input type (use this if the compiler // complains about lifetime issues named!(my_function<TkSlice<'a>>, tag!("abcd")); //prefix them with 'pub' to make the functions public named!(pub my_function, tag!("abcd"));