Improving Compiler Error Messages
Adam D. Ruppe
destructionator at gmail.com
Sun May 2 06:04:19 PDT 2010
On Sun, May 02, 2010 at 08:50:31AM -0400, Michel Fortin wrote:
> test.d(4): Error: undefined identifier wrietln, did you mean
> template writeln(T...)?
>
> It'd be nice if output like that was be a machine readable. This way,
> an editor could display misspelled words with a red underline and you
> could automatically use the suggestion by right-clicking and selecting
> it (just like spell checking in word processing apps, or in Eclipse).
> But to do that you'd need the column coordinates of the word too... too
> bad DMD doesn't track this.
You could code up something to do it with the current message. A regexp
along these lines or similar:
undefined identifier ([a-zA-Z0-9_])+, did you mean (.*)?
Then in the given line, do a plain search for $1 and offer to replace it.
Probably not 100% accurate, but I suspect it would be close enough for
most practical purposes.
More information about the Digitalmars-d
mailing list