Re: CComment

Bernhard Fischer <[email protected]>
Newsgroups gmane.comp.documentation.synopsis
Message-ID <[email protected]>
On Wed, Mar 02, 2005 at 05:08:03AM -0500, Stefan Seefeld wrote:
>Hi Bernhard,
>
>I'll comment on your patch in a separate mail.
>
>Bernhard Fischer wrote:
>
>>I've got a question regarding the implementation of CPrevious.
>>Previous is recognized by means of the '<' character at pos 0 in the
>>comment text. CPrevious OTOH does not have the '<' character but rather
>>is a comment which is positioned after some code (See struct bar in
>>foo.h contained in the tiny testcase referenced above).
>>
>>Would i implement CPrevious via
>>o putting a '<' into the comment when CComment finds code before the
>>  comment? This may be considered a rough hack but may allow me to
>>  simply reuse Previous instead of introducing a new CPrevious..
>
>How are you going to deal with the ambiguities ? Are you sure you
>want *all* comments to be appended to the declarations they document
>instead of prepended ?

What i mean is
/* foo(). this is a normal comment */
void foo(void);
/* struct bar; as the comment of foo(), this is a normal comment i.e.
   it's ^/\*
 */
struct bar {
	int an_int, /* an_int. this is *not* a normal comment: ^(^/\*) */
	    another_int; /* ditto */
};

>
>People usually put comments on top of (i.e. before) declarations,
>and thus we use a special sign for the exceptional case where this
>is not the case. If for you the exception is the rule you can
>certainly use a processor that reattaches all comments to the previous
>declaration, i.e. which does the same thing as 'Previous', but isn't
>triggered by the '<' special character.
>
>Whether you mark up your comments in a special way is really up to
>you. Synopsis was designed to adjust to you, not the other way around.

Alot of C code documents struct.members as outlined above. I cannot
change these, so i need a way to associate the comment to the corresponding
code.

The other alternative i thought of was this one:
o matching only ^/[\*]+... as CComment and introduce a CPrevious which
  associates ^(^/[\*]+)... to the respective code.


How else would i deal with e.g. enums, structs, etc? I'd be happy to
hear suggestions.


kind regards,
Bernhard
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.