Hi
I stumbled upon a bug in the doxygen syntax file
(runtime/syntax/doxygen.vim) in Vim-7.3.353 which
causes anything after /***/ to be incorrectly highlighted
as a cComment.
Steps to reproduce:
1) Create a file foo.c and edit it with vim as follows:
$ cat >foo.c <<EOF
int foo(void)
{
/***/
bar();
}
EOF
$ vim -u NONE -c 'let g:load_doxygen_syntax=1|syntax on' foo.c
2) Observe that 'bar();' is highlighted as a cComment which
is wrong. Anything after /***/ is incorrectly highlighted
as cComment.
It happens with /***/. It does not happen with /**/ or /****/.
Attached patch fixes it.
Regards
-- Dominique
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
diff -r 379a6398d462 runtime/syntax/doxygen.vim
--- a/runtime/syntax/doxygen.vim Wed Oct 26 23:48:21 2011 +0200
+++ b/runtime/syntax/doxygen.vim Wed Nov 23 18:26:06 2011 +0100
@@ -58,13 +58,15 @@
"
" C/C++ Style line comments
- syn region doxygenComment start=+/\*\(\*/\)\@![*!]+ end=+\*/+ contains=doxygenSyncStart,doxygenStart,doxygenTODO keepend fold containedin=phpRegion
+ " /**xxx*/ and /*!xxx*/ are doxygenComment.
+ " /**/ and /***/ are not doxygenComment.
+ syn region doxygenComment start=+/\*\(!\|\*\([*/]\)\@!\)+ end=+\*/+ contains=doxygenSyncStart,doxygenStart,doxygenTODO keepend fold containedin=phpRegion
syn region doxygenCommentL start=+//[/!]<\@!+me=e-1 end=+$+ contains=doxygenStartL,@Spell keepend skipwhite skipnl nextgroup=doxygenComment2 fold containedin=phpRegion
syn region doxygenCommentL start=+//[/!]<+me=e-2 end=+$+ contains=doxygenStartL,@Spell keepend skipwhite skipnl fold containedin=phpRegion
syn region doxygenCommentL start=+//@\ze[{}]+ end=+$+ contains=doxygenGroupDefine,doxygenGroupDefineSpecial,@Spell fold containedin=phpRegion
" Single line brief followed by multiline comment.
- syn region doxygenComment2 start=+/\*\(\*/\)\@![*!]+ end=+\*/+ contained contains=doxygenSyncStart2,doxygenStart2,doxygenTODO keepend fold
+ syn region doxygenComment2 start=+/\*\(!\|\*\([*/]\)\@!\)+ end=+\*/+ contained contains=doxygenSyncStart2,doxygenStart2,doxygenTODO keepend fold
" This helps with sync-ing as for some reason, syncing behaves differently to a normal region, and the start pattern does not get matched.
syn match doxygenSyncStart2 +[^*/]+ contained nextgroup=doxygenBody,doxygenPrev,doxygenStartSpecial,doxygenSkipComment,doxygenStartSkip2 skipwhite skipnl
@@ -106,12 +108,8 @@
syn match doxygenPrev +<+ contained nextgroup=doxygenBrief,doxygenBody,doxygenSpecial,doxygenStartSkip skipwhite
if exists("c_comment_strings")
- " These are anti-Doxygen comments. If there are more than two asterisks or 3 '/'s
- " then turn the comments back into normal C comments.
- syn region cComment start="/\*\*\*" end="\*/" contains=@cCommentGroup,cCommentString,cCharacter,cNumbersCom,cSpaceError
syn region cCommentL start="////" skip="\\$" end="$" contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError
else
- syn region cComment start="/\*\*\*" end="\*/" contains=@cCommentGroup,cSpaceError
syn region cCommentL start="////" skip="\\$" end="$" contains=@cCommentGroup,cSpaceError
endif