in reply to pattern matching c-style function definitions :o(

Take a look at Inline::C, it already has some code for detecting function definitions. Maybe you'll be able to adapt it to your needs.
  • Comment on Re: pattern matching c-style function definitions :o(