Creating plugin for Arduino IDE

Have you ever written a parser? Worked with YACC (and LEX)? Does LALR mean anything to you?

If you are willing to use left-to-right reading order you may be able to get close to what you want using the preprocessor.