GDMD D port ready for alpha-testing

Vladimir Panteleev via D.gnu d.gnu at puremagic.com
Sun Mar 27 01:35:00 PDT 2016


Thanks for working on this :)

On Saturday, 26 March 2016 at 22:37:53 UTC, Johannes Pfau wrote:
> I didn't realize response file parsing is that important for 
> windows, thanks for letting me know ;-) I guess there's no 
> proper documentation for response files or any test files?

It uses the CommandLineToArgvW syntax.

That's pretty much all there is to it.

> There are some open questions:
>
> * Are escape sequences allowed outside of quoted strings?

Apparently, though rdmd will never generate such response files.

> * Which characters end a comment?

There are no comments in response files (as far as I know).

> * How does this parse: foo\"bar

foo"bar

> * Or this: foo"bar

foobar

I suggest writing a small program to experiment, e.g.

void main(string[] args) { args.each!writeln(); }

> BTW:
> The DMD implementation is using the backend license, so I
> certainly couldn't copy it. It tried to follow clean-room design
> principles when reimplementing it (writing a spec first, then 
> using the
> spec to implement the new parser) and choose a completely 
> different
> parsing approach (parsing/unescaping separated, range based) so 
> I hope
> it's different enough to avoid copyright or licensing issues....

I'm not sure this approach is the best - I think unescaping and 
splitting should be done in one pass. Essentially, I think 
arguments are separated by an unescaped space.

If you have a Windows machine, you can verify it yourself by 
comparing the results with CommandLineToArgvW.

> https://github.com/D-Programming-GDC/GDMD/commit/0e2b0744a13a69f9dae90cf5db8c689ccca82f10
> It'd be great if you could have a look at the unittests and 
> tell me if
> the parsing is correct ;-)

The unit tests *look* OK, but I can't say for sure without having 
a way to verify them.

I suggest you have a look at the escaping code and tests from 
std.process. There should be no licensing conflict with Boost, I 
think. I went to great lengths to ensure that code is correct, 
there is even a test which brute-forces special character 
combinations and another that tries random strings to find bugs 
in the escaping code.

IIRC the simple regex that was in the Perl version of gdmd was 
also sufficient for parsing the response files generated by rdmd.

> Now I still have to generate a response file for passing 
> arguments to GDC. First have to check whether GCC even uses the 
> windows escaping rules though. Do you know how many characters 
> can be passed without response files?

rdmd uses a limit of 1024, but I think that's lower than the OS 
limit.



More information about the D.gnu mailing list