Want to help DMD bugfixing? Write a simple utility.
Nick Sabalausky
a at a.a
Fri Mar 25 13:44:41 PDT 2011
"Regan Heath" <regan at netmail.co.nz> wrote in message
news:op.vswbv8qj54xghj at puck.auriga.bhead.co.uk...
> On Wed, 23 Mar 2011 21:16:02 -0000, Jonathan M Davis <jmdavisProg at gmx.com>
> wrote:
>> There are tasks for which you need to be able to lex and parse D code.
>> To 100% correctly remove unit tests would be one such task.
>
> Is that last bit true? You definitely need to be able to lex it, but
> instead of actually parsing it you just count { and } and remove
> 'unittest' plus { plus } plus everything in between right?
>
No, to do it 100% reliably, you do need lexing/parsing, and also the
semantics stage. Example:
string makeATest(string str)
{
return "unit"~"test { "~str~" }";
}
mixin(makeATest(q{
// Do tests
}));
More information about the Digitalmars-d-learn
mailing list