TBH, I wasn't concerned at all about matching errors to line numbers (I didn't mention matching up the line numbers because I assumed it would anyway); I've done this sort of thing before and never had a problem setting the correct line numbers in the outputted C sources.
The problem I usually have is matching C-compiler error messages to $NEWLANG errors.
Like I said, as long as the programmer is aware that it's a preprocessor for the language and not an AST-based code generator, then there usually isn't a problem. I used ecl (or gcl, not sure now) that went the AST code-generation path and it worked much better than any preprocessor-based method in terms of compilation errors and diagnostics.
The problem I usually have is matching C-compiler error messages to $NEWLANG errors.
Like I said, as long as the programmer is aware that it's a preprocessor for the language and not an AST-based code generator, then there usually isn't a problem. I used ecl (or gcl, not sure now) that went the AST code-generation path and it worked much better than any preprocessor-based method in terms of compilation errors and diagnostics.
PS. In case you (or anyone else) is wondering about my mentioned HTML preprocessor, I put it into a gist: https://gist.github.com/lelanthran/603a24c56bc3afc1370a007a0...