Comment 4 for bug 541119

Revision history for this message
mdavidsaver (mdavidsaver) wrote :

I think everyone has been surprised by this before. I hadn't seen this ticket before though. The complexities of trying to replicate this "pre-processor" behavior in any other way is one of reasons I abandoned my attempt to replace the existing parser. It would mean tokenizing (potentially recursive) macros, which is complicated but doable. It would also be redundant to what macLib already does, but neither code could replace the other. This opens the door to inconsistencies.

While I don't plan on pursuing this myself, the only practical way I can see to deal with this issue is to teach db_yyinput() to strip out comments before macro expansion and parsing (a pre-pre-processor). One way to do this might be to, after fgets(), search the input buffer for '#' and replace it with "\n\0", then ignore input until an actual '\n' is encountered. Long lines will complicate this.