More Clang diagnostic
Michel Fortin
michel.fortin at michelf.com
Wed Oct 27 03:36:55 PDT 2010
On 2010-10-25 22:21:01 -0400, bearophile <bearophileHUGS at lycos.com> said:
> Michel Fortin:
>
>> I'd like it very much if dmd printed the column number
>> for the caret in addition to the line.
>
> The C# compiler too show those column number. But last time Walter has
> explained that to do this, the compiler has to keep more data (all
> those line numbers), so this may slow down the compilation a little.
> And of course currently this information is not present, so it probably
> requires a good amount of changes to be implemented.
It's not that hard to implement. I did a custom version of the DMD
frontend to do something similar for the early versions of D for Xcode.
I needed to have the exact start and end location of each token
expressed in character index from the beginning of the file. I used
that for syntax highlighting.
To get column numbers in error messages, here's all I'd expect you need to do:
1. add a column field to the Loc struct (in mars.h)
2. make the lexer keep track of the current column
3. make error() print that field
Give it a try if you want.
Then you can do some benchmark to check how slower it is (probably
nothing noticeable).
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list