Breaking down a function like that may be easier to achieve with a procedural macro - doing it that way, you'd be able to lean on crates like syn and quote to break down the input code.
Also, when you talk about getting function names and stuff like that: it's important to understand that macros operate purely based on the individual tokens of the code (i.e. fn, then greet_fn, then (, then name, then :, and so on...). You can't 'look up' a name in a macro, as name resolution hasn't taken place at the point in compilation where they run. I'm not sure if that's what you're trying to do, though!