D port of gdmd (Was: Re: gcc 4.8.1 made it to Debian Sid)
H. S. Teoh
hsteoh at quickfur.ath.cx
Mon Jul 22 09:59:32 PDT 2013
On Mon, Jul 22, 2013 at 10:38:36AM +0200, eles wrote:
> On Friday, 19 July 2013 at 19:06:41 UTC, H. S. Teoh wrote:
[...]
> >Not really, there are still some dmd options that dmd-script
> >supports, but gdmd.d doesn't yet.
>
> Do you mind making a list of those (here) and suggest how to
> distribute those between us?
>
> This will avoid duplicate work and will allow us keeping some focus.
Actually, I haven't had time to do much with gdmd for the past week or
so, and probably won't have that much time this week either. If you want
to work on it this week, please go ahead.
As for what is/isn't implemented yet: if you look at parseArgs(),
there's a bunch of "TBD" comments that indicate which options are
currently recognized but not implemented.
I basically went through the corresponding code in dmd-script in the
order it appears in the latter, and currently I've gotten to -op. So
pretty much everything that follows -op in dmd-script isn't recognized
yet, and needs to be implemented (in addition to the above options that
are currently recognized but not yet implemented).
Besides the actual options themselves, I'm not very happy with the
current implementation of parseArgs(). The most egregious fault with it
is that it's using a bunch of regexes that matches *both* options *and*
filenames. I'm pretty sure there are some obscure corner cases where
this is going to cause bugs. This function really should first check the
first character of each command-line argument, and if it begins with
"-", call the code that parses options, otherwise, call the code that
parses filenames.
Besides that, I think the majority of the options can be put into a
static AA for fast lookup of options without arguments. Unfortunately,
due to DMD's idiosyncratic command-line syntax, we can't do this for
options with arguments, so we'll still have to use regexes for that.
Alternatively, another approach is to parse it char-by-char until we
reach the argument part of the option, then use slicing to pick up the
latter. This would be more tedious, though, and I'm not sure it's worth
the effort (this *is* just parsing command-line options, not a
performance critical inner loop). Probably the AA lookup + regexes
approach is Good Enough(tm).
> BTW: I think it is better to start a new thread, maybe: "gdmd port"
Done.
T
--
Heads I win, tails you lose.
More information about the D.gnu
mailing list