Bug 15465 – Make the "Ddoc" header optional in .dd files

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-12-21T20:27:00Z
Last change time
2017-07-05T12:18:27Z
Assigned to
nobody
Creator
andrei

Comments

Comment #0 by andrei — 2015-12-21T20:27:02Z
Comment #1 by andrei — 2015-12-21T20:29:11Z
Files passed explicitly to dmd for doc processing and carrying the .dd extension don't need to present additional proof that they're ddoc files. The Ddoc header is a mere distraction.
Comment #2 by destructionator — 2015-12-23T01:17:21Z
Just quickly looking at the source: the compiler seems to treat .dd files identically as .d files. In any D file, if it starts with "Ddoc", it is processed as a gigantic documentation comment by dmodule.parse. (You can rename any random .dd file to .d and run it through the compiler to see this yourself btw). So for this to change, mars.d would have to tell dmodule.d that the file had the .dd extension, or otherwise treat it specially compared to other D files. Then the first few bytes can be stripped, if present, and you take it from there.
Comment #3 by andrei — 2015-12-23T01:27:38Z
(In reply to Adam D. Ruppe from comment #2) > Just quickly looking at the source: the compiler seems to treat .dd files > identically as .d files. In any D file, if it starts with "Ddoc", it is > processed as a gigantic documentation comment by dmodule.parse. (You can > rename any random .dd file to .d and run it through the compiler to see this > yourself btw). > > So for this to change, mars.d would have to tell dmodule.d that the file had > the .dd extension, or otherwise treat it specially compared to other D > files. Then the first few bytes can be stripped, if present, and you take it > from there. Yah, that's right (and might have its uses). When the information "this files has extension .dd" is present, there's no possible ambiguity so that bit needs to make the Ddoc part optional.
Comment #4 by destructionator — 2015-12-23T04:58:11Z
I have good news and bad news. Good news: this turned out to be trivial to implement! Bad news: I'm up way past bed time doing all this dmd stuff :( BOOM! https://github.com/D-Programming-Language/dmd/pull/5317 g'night y'all