------- Comment #2 from  2009-02-13 12:07 -------
But the #line is processed by the lexer, I don't see what that has to do with
lex, yacc and other CPP tools...

The problem with the pragma solution is that pragmas are processed during the
semantic pass, and line numbers are already assigned by then.

But I woudldn't mind the lexer peeking some tokens after "pragma" to see if
it's "pragma(line" to make this happen. Some "magic" in benefit of making a
programmer's life easy and making a character available for the language is
worth it.

The same goes for my idea to make version(D1), version(D2) be processed in the
lexical stage (to skip pieces of code so that you don't have to do the mixin
workaround). The only excuses for not doing this seems to be that it will make
the lexer a little harder for 3rd party tools to do. But: 1. most of the tools,
if not all of them, use DMD's front end, and 2. it's very easy compared to
other stuff that needs to be performed by a regular D compiler (mixins,
templates, etc.).


Reply via email to