[cfe-commits] [patch] \brief comment parser whitespace handling

Dmitri Gribenko gribozavr at gmail.com
Thu Aug 16 16:11:04 PDT 2012


On Thu, Aug 16, 2012 at 3:09 PM, João Matos <ripzonetriton at gmail.com> wrote:
> Attached is a patch that fixes a problem when handling \brief style
> comments.
> If the line after the first paragraph has any whitespace (following the *
> comment tokens), then the end of the paragraph check will fail, since it
> gets a text token, instead of an expected newline.
>
> Found this while trying to parse the SDL headers, so I'm attaching an
> extract of it that shows the problem in question. It only happens on the
> second struct (SDL_Rect).
>
> I'm not sure if this is the right fix, but it fixes it on this header.

Hi Joao!

Thank you for this.  The fix looks correct to me.

+      // If the next token is a whitespace only text, ignore it.

Please expand the comment to say "We don't need to add a space to the
parsed text because we just added a space for the newline".

Please also add a reduced test to test/Index/annotate-comments.cpp
after isdoxy50():

// One of the following lines has trailing whitespace.  It is
intended, don't fix it.
/**
 * Aaa. IS_DOXYGEN_START
 *##
 * Bbb. IS_DOXYGEN_END
 */
void isdoxy51(int);

Where '#' is a space.

If you don't have time to do this -- let me know.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/




More information about the cfe-commits mailing list