ddoc - documenting private variables

Adam D. Ruppe destructionator at gmail.com
Sun Oct 7 12:33:43 PDT 2012


On Sunday, 7 October 2012 at 19:36:39 UTC, Charles Hixson wrote:
> FWIW, I have absolutely NO knowledge of JSON, except that it's 
> something to do with web pages (well, and it's a language or 
> possibly a library).


I haven't actually used that project (I just saw the link and 
figured it might help) but you can make json with dmd. Run dmd -X 
-D yourfile.d and it spits out yourfile.json.


But another option might be to just modify your copy of dmd to 
output private things too. Open the file dmd2/src/dmd/doc.c and 
search for the term PROTprivate. Simply comment that part so it 
doesn't return. For example:


void EnumDeclaration::emitComment(Scope *sc)
{
     if (prot() == PROTprivate)
         return;

Just comment that out and repeat for each time you see it. I 
count six occurrences of that in the dmd source. And then there's 
this:


void Declaration::emitComment(Scope *sc)
{
     //printf("Declaration::emitComment(%p '%s'), comment = 
'%s'\n", this,       toChars(), comment);
     //printf("type = %p\n", type);

     if (protection == PROTprivate || !ident ||
         (!type && !isCtorDeclaration() && !isAliasDeclaration()))
         return;


And you can probably just comment that protection clause there 
too.


Then recompile the dmd (make -f posix.mak on linux and I think 
make -f win32.mak on windows) and use your customized compiler.


More information about the Digitalmars-d-learn mailing list