www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Ddoc/parser behavior question

reply Brian Schott <briancschott gmail.com> writes:
Consider the following code:

/// doc1
int a, /// doc2
     b, /// doc3
     c; /// doc4

Ddoc's behavior is to generate this documentation:

int a;
     doc1
     doc2

int b;
     doc1
     doc3

int c;
     doc1
     doc4

This isn't really spelled out in the ddoc spec. Is this behavior 
intentional or just a coincidence?
Jan 06
next sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2016-01-07 03:14, Brian Schott wrote:
 Consider the following code:

 /// doc1
 int a, /// doc2
      b, /// doc3
      c; /// doc4

 Ddoc's behavior is to generate this documentation:

 int a;
      doc1
      doc2

 int b;
      doc1
      doc3

 int c;
      doc1
      doc4

 This isn't really spelled out in the ddoc spec. Is this behavior
 intentional or just a coincidence?
Is it spelled out if one just do: int a; /// doc1 -- /Jacob Carlborg
Jan 07
parent Brian Schott <briancschott gmail.com> writes:
On Thursday, 7 January 2016 at 08:40:37 UTC, Jacob Carlborg wrote:
 Is it spelled out if one just do:

 int a; /// doc1
Yes, but that's not my question. The behavior that I'm talking about is that the comment on the line before the line containing "int" is applied to all three variables, and that the comments following the commas and semicolons apply to the variables individually.
Jan 07
prev sibling parent reply Jack Stouffer <jack jackstouffer.com> writes:
On Thursday, 7 January 2016 at 02:14:50 UTC, Brian Schott wrote:
 Consider the following code:

 /// doc1
 int a, /// doc2
     b, /// doc3
     c; /// doc4

 Ddoc's behavior is to generate this documentation:

 int a;
     doc1
     doc2

 int b;
     doc1
     doc3

 int c;
     doc1
     doc4
That looks intentional, and IMO is what makes sense. You have the global comment for the declaration and individual comments for each.
Jan 07
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 01/07/2016 12:25 PM, Jack Stouffer wrote:
 On Thursday, 7 January 2016 at 02:14:50 UTC, Brian Schott wrote:
 Consider the following code:

 /// doc1
 int a, /// doc2
     b, /// doc3
     c; /// doc4

 Ddoc's behavior is to generate this documentation:

 int a;
     doc1
     doc2

 int b;
     doc1
     doc3

 int c;
     doc1
     doc4
That looks intentional, and IMO is what makes sense. You have the global comment for the declaration and individual comments for each.
Could someone please contribute the appropriate bit/example in the docs? Thx! -- Andrei
Jan 07