fix macro parsing

Revised approach to parsing the macros. This time we find all potential
macro instances and weed out the ones that are not macros. The regex
expressions work better with this approach.