Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 1 | " DoxyGen syntax hilighting extension for c/c++/idl/java |
Bram Moolenaar | e37d50a | 2008-08-06 17:06:04 +0000 | [diff] [blame] | 2 | " Language: doxygen on top of c, cpp, idl, java, php |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 3 | " Maintainer: Michael Geddes <vimmer@frog.wheelycreek.net> |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 4 | " Author: Michael Geddes |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 5 | " Last Change: November 2017 (\throws by Candy Gumdrop) |
| 6 | " Version: 1.27 |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 7 | " |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 8 | " Copyright 2004-2017 Michael Geddes |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 9 | " Please feel free to use, modify & distribute all or part of this script, |
| 10 | " providing this copyright message remains. |
| 11 | " I would appreciate being acknowledged in any derived scripts, and would |
| 12 | " appreciate and welcome any updates, modifications or suggestions. |
| 13 | |
| 14 | " NOTE: Comments welcome! |
| 15 | " |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 16 | " There are two variables that control the syntax highlighting produced by this |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 17 | " script: |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 18 | " doxygen_enhanced_colour - Use the (non-standard) original colours designed |
| 19 | " for this highlighting. |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 20 | " doxygen_my_rendering - Disable the HTML bold/italic/underline rendering. |
| 21 | " |
| 22 | " A brief description without '.' or '!' will cause the end comment |
| 23 | " character to be marked as an error. You can define the colour of this using |
| 24 | " the highlight doxygenErrorComment. |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 25 | " A \link without an \endlink will cause an error highlight on the end-comment. |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 26 | " This is defined by doxygenLinkError |
| 27 | " |
| 28 | " The variable g:doxygen_codeword_font can be set to the guifont for marking \c |
| 29 | " words - a 'typewriter' like font normally. Spaces must be escaped. It can |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 30 | " also be set to any highlight attribute. Alternatively, a highlight for doxygenCodeWord |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 31 | " can be used to override it. |
| 32 | " |
Bram Moolenaar | e37d50a | 2008-08-06 17:06:04 +0000 | [diff] [blame] | 33 | " By default, highlighting is done assuming you have the JAVADOC_AUTOBRIEF |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 34 | " setting turned on in your Doxygen configuration. If you don't, you |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 35 | " can set the variable g:doxygen_javadoc_autobrief to 0 to have the |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 36 | " highlighting more accurately reflect the way Doxygen will interpret your |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 37 | " comments. |
| 38 | " |
Bram Moolenaar | e37d50a | 2008-08-06 17:06:04 +0000 | [diff] [blame] | 39 | " Support for cpp, c, idl, doxygen and php. |
| 40 | " |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 41 | " Special thanks to: Wu Yongwei, Toby Allsopp |
| 42 | " |
| 43 | |
| 44 | if exists('b:suppress_doxygen') |
| 45 | unlet b:suppress_doxygen |
| 46 | finish |
| 47 | endif |
| 48 | |
| 49 | if exists('b:current_syntax') && b:current_syntax =~ 'doxygen' && !exists('doxygen_debug_script') |
| 50 | finish |
| 51 | endif |
| 52 | |
| 53 | let s:cpo_save = &cpo |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 54 | try |
| 55 | set cpo&vim |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 56 | |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 57 | " Start of Doxygen syntax hilighting: |
| 58 | " |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 59 | |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 60 | " C/C++ Style line comments |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 61 | syn match doxygenCommentWhite +\s*\ze/\*\(\*/\)\@![*!]+ containedin=phpRegion |
| 62 | syn match doxygenCommentWhite +\s*\ze//[/!]+ containedin=phpRegion |
| 63 | syn match doxygenCommentWhite +\s*\ze/\*\(\*/\)\@![*!]+ |
| 64 | syn match doxygenCommentWhite +\s*\ze//[/!]+ containedin=phpRegion |
| 65 | |
| 66 | syn region doxygenComment start=+/\*\(\*/\)\@![*!]+ end=+\*/+ contains=doxygenSyncStart,doxygenStart,doxygenTODO,doxygenLeadingWhite keepend fold containedin=phpRegion |
| 67 | syn region doxygenCommentL start=+//[/!]<\@!+me=e-1 end=+$+ contains=doxygenLeadingLWhite,doxygenStartL,@Spell keepend skipwhite skipnl nextgroup=doxygenCommentWhite2 fold containedin=phpRegion |
Bram Moolenaar | e37d50a | 2008-08-06 17:06:04 +0000 | [diff] [blame] | 68 | syn region doxygenCommentL start=+//[/!]<+me=e-2 end=+$+ contains=doxygenStartL,@Spell keepend skipwhite skipnl fold containedin=phpRegion |
| 69 | syn region doxygenCommentL start=+//@\ze[{}]+ end=+$+ contains=doxygenGroupDefine,doxygenGroupDefineSpecial,@Spell fold containedin=phpRegion |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 70 | syn region doxygenComment start=+/\*@\ze[{}]+ end=+\*/+ contains=doxygenGroupDefine,doxygenGroupDefineSpecial,@Spell fold containedin=phpRegion |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 71 | |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 72 | " Single line brief followed by multiline comment. |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 73 | syn match doxygenCommentWhite2 +\_s*\ze/\*\(\*/\)\@![*!]+ contained nextgroup=doxygenComment2 |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 74 | syn region doxygenComment2 start=+/\*\(\*/\)\@![*!]+ end=+\*/+ contained contains=doxygenSyncStart2,doxygenStart2,doxygenTODO keepend fold |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 75 | " This helps with sync-ing as for some reason, syncing behaves differently to a normal region, and the start pattern does not get matched. |
| 76 | syn match doxygenSyncStart2 +[^*/]+ contained nextgroup=doxygenBody,doxygenPrev,doxygenStartSpecial,doxygenSkipComment,doxygenStartSkip2 skipwhite skipnl |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 77 | |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 78 | " Skip empty lines at the start for when comments start on the 2nd/3rd line. |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 79 | syn match doxygenStartSkip2 +^\s*\*[^/]+me=e-1 contained nextgroup=doxygenBody,doxygenStartSpecial,doxygenStartSkipWhite skipwhite skipnl |
| 80 | syn match doxygenStartSkip2 +^\s*\*$+ contained nextgroup=doxygenBody,doxygenStartSpecial,doxygenStartSkipWhite skipwhite skipnl |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 81 | syn match doxygenStart2 +/\*[*!]+ contained nextgroup=doxygenBody,doxygenPrev,doxygenStartSpecial,doxygenStartSkip2 skipwhite skipnl |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 82 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 83 | |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 84 | " Match the Starting pattern (effectively creating the start of a BNF) |
| 85 | if !exists('g:doxygen_javadoc_autobrief') || g:doxygen_javadoc_autobrief |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 86 | syn match doxygenStart +/\*[*!]+ contained nextgroup=doxygenBrief,doxygenPrev,doxygenFindBriefSpecial,doxygenStartSpecial,doxygenStartSkipWhite,doxygenPage skipwhite skipnl |
| 87 | syn match doxygenLeadingLWhite +\s\++ contained nextgroup=doxygenPrevL,doxygenBriefL,doxygenSpecial |
| 88 | syn match doxygenStartL +//[/!]+ contained nextgroup=doxygenLeaingLWhite,doxygenPrevL,doxygenBriefL,doxygenSpecial |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 89 | " Match the first sentence as a brief comment |
| 90 | if ! exists('g:doxygen_end_punctuation') |
| 91 | let g:doxygen_end_punctuation='[.]' |
| 92 | endif |
| 93 | |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 94 | exe 'syn region doxygenBrief contained start=+[\\@]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]+ start=+\(^\s*\)\@<!\*/\@!+ start=+\<\k+ skip=+'.doxygen_end_punctuation.'\S\@=+ end=+'.doxygen_end_punctuation.'+ end=+\(\s*\(\n\s*\*\=\s*\)[@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\@=+ contains=doxygenSmallSpecial,doxygenContinueCommentWhite,doxygenLeadingWhite,doxygenBriefEndComment,doxygenFindBriefSpecial,doxygenSmallSpecial,@doxygenHtmlGroup,doxygenTODO,doxygenHyperLink,doxygenHashLink,@Spell skipnl nextgroup=doxygenBody' |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 95 | |
| 96 | syn match doxygenBriefEndComment +\*/+ contained |
| 97 | |
| 98 | exe 'syn region doxygenBriefL start=+@\k\@!\|[\\@]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@]+ start=+\<+ skip=+'.doxygen_end_punctuation.'\S+ end=+'.doxygen_end_punctuation.'\|$+ contained contains=doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell keepend' |
| 99 | syn match doxygenPrevL +<+ contained nextgroup=doxygenBriefL,doxygenSpecial skipwhite |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 100 | else |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 101 | syn match doxygenStart +/\*[*!]+ contained nextgroup=doxygenBody,doxygenPrev,doxygenFindBriefSpecial,doxygenStartSpecial,doxygenStartSkipWhite,doxygenPage skipwhite skipnl |
| 102 | syn match doxygenStartL +//[/!]+ contained nextgroup=doxygenLeadingLWhite,doxygenPrevL,doxygenLine,doxygenSpecial |
| 103 | syn match doxygenLeadingLWhite +\s\++ contained nextgroup=doxygenPrevL,doxygenLine,doxygenSpecial |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 104 | syn region doxygenLine start=+@\k\@!\|[\\@]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@<]+ start=+\<+ end='$' contained contains=doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell keepend |
| 105 | syn match doxygenPrevL +<+ contained nextgroup=doxygenLine,doxygenSpecial skipwhite |
| 106 | |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 107 | endif |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 108 | |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 109 | " This helps with sync-ing as for some reason, syncing behaves differently to a normal region, and the start pattern does not get matched. |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 110 | syn match doxygenSyncStart +\ze[^*/]+ contained nextgroup=doxygenBrief,doxygenPrev,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkipWhite,doxygenPage skipwhite skipnl |
| 111 | " Match an [@\]brief so that it moves to body-mode. |
| 112 | " |
| 113 | " |
| 114 | " syn match doxygenBriefLine contained |
| 115 | syn match doxygenBriefSpecial contained +[@\\]+ nextgroup=doxygenBriefWord skipwhite |
| 116 | " syn region doxygenFindBriefSpecial start=+[@\\]brief\>+ end=+\(\n\s*\*\=\s*\([@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\|\s*$\)\@=+ keepend contains=doxygenBriefSpecial nextgroup=doxygenBody keepend skipwhite skipnl contained |
| 117 | syn region doxygenFindBriefSpecial start=+[@\\]brief\>+ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ keepend contains=doxygenBriefSpecial nextgroup=doxygenBody keepend skipwhite skipnl contained |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 118 | |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 119 | |
| 120 | |
| 121 | " end=+\(\n\s*\*\=\s*\([@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\|\s*$\)\@=+ |
| 122 | "syn region doxygenBriefLine contained start=+\<\k+ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ contains=doxygenContinueCommentWhite,doxygenSmallSpecial,@doxygenHtmlGroup,doxygenTODO,doxygenHyperLink,doxygenHashLink,@Spell skipwhite keepend matchgroup=xxx |
| 123 | syn region doxygenBriefLine contained start=+\<\k+ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ skipwhite keepend matchgroup=xxx |
| 124 | " syn region doxygenBriefLine matchgroup=xxxy contained start=+\<\k.\++ skip=+^\s*\k+ end=+end+ skipwhite keepend |
| 125 | "doxygenFindBriefSpecial, |
| 126 | "" syn region doxygenSpecialMultilineDesc start=+.\++ contained contains=doxygenSpecialContinueCommentWhite,doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell skipwhite keepend |
| 127 | |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 128 | |
| 129 | " Match a '<' for applying a comment to the previous element. |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 130 | syn match doxygenPrev +<+ contained nextgroup=doxygenBrief,doxygenBody,doxygenSpecial,doxygenStartSkipWhite skipwhite |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 131 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 132 | if exists("c_comment_strings") |
| 133 | " These are anti-Doxygen comments. If there are more than two asterisks or 3 '/'s |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 134 | " then turn the comments back into normal C comments. |
| 135 | syn region cComment start="/\*\*\*" end="\*/" contains=@cCommentGroup,cCommentString,cCharacter,cNumbersCom,cSpaceError |
| 136 | syn region cCommentL start="////" skip="\\$" end="$" contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 137 | else |
| 138 | syn region cComment start="/\*\*\*" end="\*/" contains=@cCommentGroup,cSpaceError |
| 139 | syn region cCommentL start="////" skip="\\$" end="$" contains=@cCommentGroup,cSpaceError |
| 140 | endif |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 141 | |
| 142 | " Special commands at the start of the area: starting with '@' or '\' |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 143 | syn region doxygenStartSpecial contained start=+[@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!+ end=+$+ end=+\*/+me=s-1,he=s-1 contains=doxygenSpecial nextgroup=doxygenSkipComment skipnl keepend |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 144 | syn match doxygenSkipComment contained +^\s*\*/\@!+ nextgroup=doxygenBrief,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenPage skipwhite |
| 145 | |
| 146 | "syn region doxygenBodyBit contained start=+$+ |
| 147 | |
| 148 | " The main body of a doxygen comment. |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 149 | syn region doxygenBody contained start=+\(/\*[*!]\)\@<!<\|[^<]\|$+ matchgroup=doxygenEndComment end=+\*/+re=e-2,me=e-2 contains=doxygenContinueCommentWhite,doxygenTODO,doxygenSpecial,doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 150 | |
| 151 | " These allow the skipping of comment continuation '*' characters. |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 152 | syn match doxygenContinueCommentWhite contained +^\s*\ze\*+ nextgroup=doxygenContinueComment |
| 153 | syn match doxygenContinueComment contained +\*/\@!+ |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 154 | |
| 155 | " Catch a Brief comment without punctuation - flag it as an error but |
| 156 | " make sure the end comment is picked up also. |
| 157 | syn match doxygenErrorComment contained +\*/+ |
| 158 | |
| 159 | |
| 160 | " Skip empty lines at the start for when comments start on the 2nd/3rd line. |
| 161 | if !exists('g:doxygen_javadoc_autobrief') || g:doxygen_javadoc_autobrief |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 162 | syn match doxygenStartSkipWhite +^\s*\ze\*/\@!+ contained nextgroup=doxygenBrief,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkipWhite,doxygenPage skipwhite skipnl |
| 163 | "syn match doxygenStartSkipWhite +^\s*\ze\*$+ contained nextgroup=doxygenBrief,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkipWhite,doxygenPage skipwhite skipnl |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 164 | else |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 165 | syn match doxygenStartSkipWhite +^\s*\*[^/]+me=e-1 contained nextgroup=doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkipWhite,doxygenPage,doxygenBody skipwhite skipnl |
| 166 | syn match doxygenStartSkipWhite +^\s*\*$+ contained nextgroup=doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkipWhite,doxygenPage,doxygenBody skipwhite skipnl |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 167 | endif |
| 168 | |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 169 | " Create the single word matching special identifiers. |
| 170 | |
| 171 | fun! s:DxyCreateSmallSpecial( kword, name ) |
| 172 | |
| 173 | let mx='[-:0-9A-Za-z_%=&+*/!~>|]\@<!\([-0-9A-Za-z_%=+*/!~>|#]\+[-0-9A-Za-z_%=+*/!~>|]\@!\|\\[\\<>&.]@\|[.,][0-9a-zA-Z_]\@=\|::\|([^)]*)\|&[0-9a-zA-Z]\{2,7};\)\+' |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 174 | exe 'syn region doxygenSpecial'.a:name.'Word contained start=+'.a:kword.'+ end=+\(\_s\+'.mx.'\)\@<=[-a-zA-Z_0-9+*/^%|~!=&\\]\@!+ skipwhite contains=doxygenContinueCommentWhite,doxygen'.a:name.'Word' |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 175 | exe 'syn match doxygen'.a:name.'Word contained "\_s\@<='.mx.'" contains=doxygenHtmlSpecial,@Spell keepend' |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 176 | endfun |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 177 | call s:DxyCreateSmallSpecial('p', 'Code') |
| 178 | call s:DxyCreateSmallSpecial('c', 'Code') |
| 179 | call s:DxyCreateSmallSpecial('b', 'Bold') |
| 180 | call s:DxyCreateSmallSpecial('e', 'Emphasised') |
| 181 | call s:DxyCreateSmallSpecial('em', 'Emphasised') |
| 182 | call s:DxyCreateSmallSpecial('a', 'Argument') |
| 183 | call s:DxyCreateSmallSpecial('ref', 'Ref') |
| 184 | delfun s:DxyCreateSmallSpecial |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 185 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 186 | syn match doxygenSmallSpecial contained +[@\\]\(\<[npcbea]\>\|\<em\>\|\<ref\>\|\<link\>\|f\$\|[$\\&<>#]\)\@=+ nextgroup=doxygenOtherLink,doxygenHyperLink,doxygenHashLink,doxygenFormula,doxygenSymbol,doxygenSpecial.*Word |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 187 | |
| 188 | " Now for special characters |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 189 | syn match doxygenSpecial contained +[@\\]\(\<[npcbea]\>\|\<em\>\|\<ref\|\<link\>\>\|\<f\$\|[$\\&<>#]\)\@!+ nextgroup=doxygenParam,doxygenRetval,doxygenBriefWord,doxygenBold,doxygenBOther,doxygenOther,doxygenOtherTODO,doxygenOtherWARN,doxygenOtherBUG,doxygenPage,doxygenGroupDefine,doxygenCodeRegion,doxygenVerbatimRegion,doxygenDotRegion |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 190 | " doxygenOtherLink,doxygenSymbol,doxygenFormula,doxygenErrorSpecial,doxygenSpecial.*Word |
| 191 | " |
| 192 | syn match doxygenGroupDefine contained +@\@<=[{}]+ |
| 193 | syn match doxygenGroupDefineSpecial contained +@\ze[{}]+ |
| 194 | |
| 195 | syn match doxygenErrorSpecial contained +\s+ |
| 196 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 197 | " Match parameters and retvals (highlighting the first word as special). |
| 198 | syn match doxygenParamDirection contained "\v\[(\s*in>((]\s*\[|\s*,\s*)out>)=|out>((]\s*\[|\s*,\s*)in>)=)\]" nextgroup=doxygenParamName skipwhite |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 199 | syn keyword doxygenParam contained param nextgroup=doxygenParamName,doxygenParamDirection skipwhite |
| 200 | syn keyword doxygenTParam contained tparam nextgroup=doxygenParamName skipwhite |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 201 | syn match doxygenParamName contained +[A-Za-z0-9_:]\++ nextgroup=doxygenSpecialMultilineDesc skipwhite |
Bram Moolenaar | b0d45e7 | 2017-11-05 18:19:24 +0100 | [diff] [blame] | 202 | syn keyword doxygenRetval contained retval throw throws exception nextgroup=doxygenParamName skipwhite |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 203 | |
| 204 | " Match one line identifiers. |
| 205 | syn keyword doxygenOther contained addindex anchor |
| 206 | \ dontinclude endhtmlonly endlatexonly showinitializer hideinitializer |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 207 | \ example htmlonly image include includelineno ingroup internal latexonly line |
| 208 | \ overload relates relatesalso sa skip skipline |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 209 | \ until verbinclude version addtogroup htmlinclude copydoc dotfile |
| 210 | \ xmlonly endxmlonly |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 211 | \ nextgroup=doxygenSpecialOnelineDesc copybrief copydetails copyright dir extends |
| 212 | \ implements |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 213 | |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 214 | syn region doxygenCodeRegion contained matchgroup=doxygenOther start=+\<code\>+ matchgroup=doxygenOther end=+[\\@]\@<=\<endcode\>+ contains=doxygenCodeRegionSpecial,doxygenContinueCommentWhite,doxygenErrorComment,@NoSpell |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 215 | syn match doxygenCodeRegionSpecial contained +[\\@]\(endcode\>\)\@=+ |
| 216 | |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 217 | syn region doxygenVerbatimRegion contained matchgroup=doxygenOther start=+\<verbatim\>+ matchgroup=doxygenOther end=+[\\@]\@<=\<endverbatim\>+ contains=doxygenVerbatimRegionSpecial,doxygenContinueCommentWhite,doxygenErrorComment,@NoSpell |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 218 | syn match doxygenVerbatimRegionSpecial contained +[\\@]\(endverbatim\>\)\@=+ |
| 219 | |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 220 | if exists('b:current_syntax') |
Bram Moolenaar | eb3593b | 2006-04-22 22:33:57 +0000 | [diff] [blame] | 221 | let b:doxygen_syntax_save=b:current_syntax |
| 222 | unlet b:current_syntax |
| 223 | endif |
| 224 | |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 225 | syn include @Dotx syntax/dot.vim |
Bram Moolenaar | eb3593b | 2006-04-22 22:33:57 +0000 | [diff] [blame] | 226 | |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 227 | if exists('b:doxygen_syntax_save') |
Bram Moolenaar | eb3593b | 2006-04-22 22:33:57 +0000 | [diff] [blame] | 228 | let b:current_syntax=b:doxygen_syntax_save |
| 229 | unlet b:doxygen_syntax_save |
| 230 | else |
| 231 | unlet b:current_syntax |
| 232 | endif |
| 233 | |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 234 | syn region doxygenDotRegion contained matchgroup=doxygenOther start=+\<dot\>+ matchgroup=doxygenOther end=+[\\@]\@<=\<enddot\>+ contains=doxygenDotRegionSpecial,doxygenErrorComment,doxygenContinueCommentWhite,@NoSpell,@Dotx |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 235 | syn match doxygenDotRegionSpecial contained +[\\@]\(enddot\>\)\@=+ |
| 236 | |
| 237 | " Match single line identifiers. |
| 238 | syn keyword doxygenBOther contained class enum file fn mainpage interface |
| 239 | \ namespace struct typedef union var def name |
| 240 | \ nextgroup=doxygenSpecialTypeOnelineDesc |
| 241 | |
| 242 | syn keyword doxygenOther contained par nextgroup=doxygenHeaderLine |
| 243 | syn region doxygenHeaderLine start=+.+ end=+^+ contained skipwhite nextgroup=doxygenSpecialMultilineDesc |
| 244 | |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 245 | syn keyword doxygenOther contained arg author authors date deprecated li return returns see invariant note post pre remarks since test nextgroup=doxygenSpecialMultilineDesc |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 246 | syn keyword doxygenOtherTODO contained todo attention nextgroup=doxygenSpecialMultilineDesc |
| 247 | syn keyword doxygenOtherWARN contained warning nextgroup=doxygenSpecialMultilineDesc |
| 248 | syn keyword doxygenOtherBUG contained bug nextgroup=doxygenSpecialMultilineDesc |
| 249 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 250 | " Handle \link, \endlink, highlighting the link-to and the link text bits separately. |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 251 | syn region doxygenOtherLink matchgroup=doxygenOther start=+\<link\>+ end=+[\@]\@<=endlink\>+ contained contains=doxygenLinkWord,doxygenContinueCommentWhite,doxygenLinkError,doxygenEndlinkSpecial |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 252 | syn match doxygenEndlinkSpecial contained +[\\@]\zeendlink\>+ |
| 253 | |
| 254 | syn match doxygenLinkWord "[_a-zA-Z:#()][_a-z0-9A-Z:#()]*\>" contained skipnl nextgroup=doxygenLinkRest,doxygenContinueLinkComment |
| 255 | syn match doxygenLinkRest +[^*@\\]\|\*/\@!\|[@\\]\(endlink\>\)\@!+ contained skipnl nextgroup=doxygenLinkRest,doxygenContinueLinkComment |
| 256 | syn match doxygenContinueLinkComment contained +^\s*\*\=[^/]+me=e-1 nextgroup=doxygenLinkRest |
| 257 | syn match doxygenLinkError "\*/" contained |
| 258 | " #Link hilighting. |
| 259 | syn match doxygenHashLink /\([a-zA-Z_][0-9a-zA-Z_]*\)\?#\(\.[0-9a-zA-Z_]\@=\|[a-zA-Z0-9_]\+\|::\|()\)\+/ contained contains=doxygenHashSpecial |
| 260 | syn match doxygenHashSpecial /#/ contained |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 261 | syn match doxygenHyperLink /\(\s\|^\s*\*\?\)\@<=\(http\|https\|ftp\):\/\/[-0-9a-zA-Z_?&=+#%/.!':;@~]\+/ contained |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 262 | |
| 263 | " Handle \page. This does not use doxygenBrief. |
| 264 | syn match doxygenPage "[\\@]page\>"me=s+1 contained skipwhite nextgroup=doxygenPagePage |
| 265 | syn keyword doxygenPagePage page contained skipwhite nextgroup=doxygenPageIdent |
| 266 | syn region doxygenPageDesc start=+.\++ end=+$+ contained skipwhite contains=doxygenSmallSpecial,@doxygenHtmlGroup keepend skipwhite skipnl nextgroup=doxygenBody |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 267 | syn match doxygenPageIdent "\<[a-zA-Z_0-9]\+\>" contained nextgroup=doxygenPageDesc |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 268 | |
| 269 | " Handle section |
| 270 | syn keyword doxygenOther defgroup section subsection subsubsection weakgroup contained skipwhite nextgroup=doxygenSpecialIdent |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 271 | syn region doxygenSpecialSectionDesc start=+.\++ end=+$+ contained skipwhite contains=doxygenSmallSpecial,@doxygenHtmlGroup keepend skipwhite skipnl nextgroup=doxygenContinueCommentWhite |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 272 | syn match doxygenSpecialIdent "\<[a-zA-Z_0-9]\+\>" contained nextgroup=doxygenSpecialSectionDesc |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 273 | |
| 274 | " Does the one-line description for the one-line type identifiers. |
| 275 | syn region doxygenSpecialTypeOnelineDesc start=+.\++ end=+$+ contained skipwhite contains=doxygenSmallSpecial,@doxygenHtmlGroup keepend |
| 276 | syn region doxygenSpecialOnelineDesc start=+.\++ end=+$+ contained skipwhite contains=doxygenSmallSpecial,@doxygenHtmlGroup keepend |
| 277 | |
| 278 | " Handle the multiline description for the multiline type identifiers. |
| 279 | " Continue until an 'empty' line (can contain a '*' continuation) or until the |
| 280 | " next whole-line @ command \ command. |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 281 | syn region doxygenSpecialMultilineDesc start=+.\++ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ contained contains=doxygenSpecialContinueCommentWhite,doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell skipwhite keepend |
| 282 | |
| 283 | " syn match doxygenSpecialContinueComment contained +^\s*\*/\@!\s*+ nextgroup=doxygenSpecial skipwhite |
| 284 | syn match doxygenSpecialContinueCommentWhite contained +^\s*\ze\*+ nextgroup=doxygenSpecialContinueComment |
| 285 | syn match doxygenSpecialContinueComment contained +\*/\@!+ |
| 286 | |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 287 | |
| 288 | " Handle special cases 'bold' and 'group' |
| 289 | syn keyword doxygenBold contained bold nextgroup=doxygenSpecialHeading |
| 290 | syn keyword doxygenBriefWord contained brief nextgroup=doxygenBriefLine skipwhite |
| 291 | syn match doxygenSpecialHeading +.\++ contained skipwhite |
| 292 | syn keyword doxygenGroup contained group nextgroup=doxygenGroupName skipwhite |
| 293 | syn keyword doxygenGroupName contained +\k\++ nextgroup=doxygenSpecialOnelineDesc skipwhite |
| 294 | |
| 295 | " Handle special symbol identifiers @$, @\, @$ etc |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 296 | syn match doxygenSymbol contained +[$\\&<>#n]+ |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 297 | |
| 298 | " Simplistic handling of formula regions |
| 299 | syn region doxygenFormula contained matchgroup=doxygenFormulaEnds start=+f\$+ end=+[@\\]f\$+ contains=doxygenFormulaSpecial,doxygenFormulaOperator |
| 300 | syn match doxygenFormulaSpecial contained +[@\\]\(f[^$]\|[^f]\)+me=s+1 nextgroup=doxygenFormulaKeyword,doxygenFormulaEscaped |
| 301 | syn match doxygenFormulaEscaped contained "." |
| 302 | syn match doxygenFormulaKeyword contained "[a-z]\+" |
| 303 | syn match doxygenFormulaOperator contained +[_^]+ |
| 304 | |
| 305 | syn region doxygenFormula contained matchgroup=doxygenFormulaEnds start=+f\[+ end=+[@\\]f]+ contains=doxygenFormulaSpecial,doxygenFormulaOperator,doxygenAtom |
| 306 | syn region doxygenAtom contained transparent matchgroup=doxygenFormulaOperator start=+{+ end=+}+ contains=doxygenAtom,doxygenFormulaSpecial,doxygenFormulaOperator |
| 307 | |
| 308 | " Add TODO hilighting. |
| 309 | syn keyword doxygenTODO contained TODO README XXX FIXME |
| 310 | |
| 311 | " Supported HTML subset. Not perfect, but okay. |
| 312 | syn case ignore |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 313 | syn region doxygenHtmlTag contained matchgroup=doxygenHtmlCh start=+\v\</=\ze([biuap]|em|strong|img|br|center|code|dfn|d[ldt]|hr|h[0-3]|li|[ou]l|pre|small|sub|sup|table|tt|var|caption|src|alt|longdesc|name|height|width|usemap|ismap|href|type)>+ skip=+\\<\|\<\k\+=\("[^"]*"\|'[^']*\)+ end=+>+ contains=doxygenHtmlCmd,doxygenContinueCommentWhite,doxygenHtmlVar |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 314 | syn keyword doxygenHtmlCmd contained b i em strong u img a br p center code dfn dl dd dt hr h1 h2 h3 li ol ul pre small sub sup table tt var caption nextgroup=doxygenHtmlVar skipwhite |
| 315 | syn keyword doxygenHtmlVar contained src alt longdesc name height width usemap ismap href type nextgroup=doxygenHtmlEqu skipwhite |
| 316 | syn match doxygenHtmlEqu contained +=+ nextgroup=doxygenHtmlExpr skipwhite |
| 317 | syn match doxygenHtmlExpr contained +"\(\\.\|[^"]\)*"\|'\(\\.\|[^']\)*'+ nextgroup=doxygenHtmlVar skipwhite |
| 318 | syn case match |
| 319 | syn match doxygenHtmlSpecial contained "&\(copy\|quot\|[AEIOUYaeiouy]uml\|[AEIOUYaeiouy]acute\|[AEIOUaeiouy]grave\|[AEIOUaeiouy]circ\|[ANOano]tilde\|szlig\|[Aa]ring\|nbsp\|gt\|lt\|amp\);" |
| 320 | |
| 321 | syn cluster doxygenHtmlGroup contains=doxygenHtmlCode,doxygenHtmlBold,doxygenHtmlUnderline,doxygenHtmlItalic,doxygenHtmlSpecial,doxygenHtmlTag,doxygenHtmlLink |
| 322 | |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 323 | syn cluster doxygenHtmlTop contains=@Spell,doxygenHtmlSpecial,doxygenHtmlTag,doxygenContinueCommentWhite |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 324 | " Html Support |
| 325 | syn region doxygenHtmlLink contained start=+<[aA]\>\s*\(\n\s*\*\s*\)\=\(\(name\|href\)=\("[^"]*"\|'[^']*'\)\)\=\s*>+ end=+</[aA]>+me=e-4 contains=@doxygenHtmlTop |
| 326 | hi link doxygenHtmlLink Underlined |
| 327 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 328 | syn region doxygenHtmlBold contained start="\c<b\>" end="\c</b>"me=e-4 contains=@doxygenHtmlTop,doxygenHtmlBoldUnderline,doxygenHtmlBoldItalic,@Spell |
| 329 | syn region doxygenHtmlBold contained start="\c<strong\>" end="\c</strong>"me=e-9 contains=@doxygenHtmlTop,doxygenHtmlBoldUnderline,doxygenHtmlBoldItalic,@Spell |
| 330 | syn region doxygenHtmlBoldUnderline contained start="\c<u\>" end="\c</u>"me=e-4 contains=@doxygenHtmlTop,doxygenHtmlBoldUnderlineItalic,@Spell |
| 331 | syn region doxygenHtmlBoldItalic contained start="\c<i\>" end="\c</i>"me=e-4 contains=@doxygenHtmlTop,doxygenHtmlBoldItalicUnderline,@Spell |
| 332 | syn region doxygenHtmlBoldItalic contained start="\c<em\>" end="\c</em>"me=e-5 contains=@doxygenHtmlTop,doxygenHtmlBoldItalicUnderline,@Spell |
| 333 | syn region doxygenHtmlBoldUnderlineItalic contained start="\c<i\>" end="\c</i>"me=e-4 contains=@doxygenHtmlTop,@Spell |
| 334 | syn region doxygenHtmlBoldUnderlineItalic contained start="\c<em\>" end="\c</em>"me=e-5 contains=@doxygenHtmlTop,@Spell |
| 335 | syn region doxygenHtmlBoldItalicUnderline contained start="\c<u\>" end="\c</u>"me=e-4 contains=@doxygenHtmlTop,doxygenHtmlBoldUnderlineItalic,@Spell |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 336 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 337 | syn region doxygenHtmlUnderline contained start="\c<u\>" end="\c</u>"me=e-4 contains=@doxygenHtmlTop,doxygenHtmlUnderlineBold,doxygenHtmlUnderlineItalic,@Spell |
| 338 | syn region doxygenHtmlUnderlineBold contained start="\c<b\>" end="\c</b>"me=e-4 contains=@doxygenHtmlTop,doxygenHtmlUnderlineBoldItalic,@Spell |
| 339 | syn region doxygenHtmlUnderlineBold contained start="\c<strong\>" end="\c</strong>"me=e-9 contains=@doxygenHtmlTop,doxygenHtmlUnderlineBoldItalic,@Spell |
| 340 | syn region doxygenHtmlUnderlineItalic contained start="\c<i\>" end="\c</i>"me=e-4 contains=@doxygenHtmlTop,htmUnderlineItalicBold,@Spell |
| 341 | syn region doxygenHtmlUnderlineItalic contained start="\c<em\>" end="\c</em>"me=e-5 contains=@doxygenHtmlTop,htmUnderlineItalicBold,@Spell |
| 342 | syn region doxygenHtmlUnderlineItalicBold contained start="\c<b\>" end="\c</b>"me=e-4 contains=@doxygenHtmlTop,@Spell |
| 343 | syn region doxygenHtmlUnderlineItalicBold contained start="\c<strong\>" end="\c</strong>"me=e-9 contains=@doxygenHtmlTop,@Spell |
| 344 | syn region doxygenHtmlUnderlineBoldItalic contained start="\c<i\>" end="\c</i>"me=e-4 contains=@doxygenHtmlTop,@Spell |
| 345 | syn region doxygenHtmlUnderlineBoldItalic contained start="\c<em\>" end="\c</em>"me=e-5 contains=@doxygenHtmlTop,@Spell |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 346 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 347 | syn region doxygenHtmlItalic contained start="\c<i\>" end="\c</i>"me=e-4 contains=@doxygenHtmlTop,doxygenHtmlItalicBold,doxygenHtmlItalicUnderline,@Spell |
| 348 | syn region doxygenHtmlItalic contained start="\c<em\>" end="\c</em>"me=e-5 contains=@doxygenHtmlTop,@Spell |
| 349 | syn region doxygenHtmlItalicBold contained start="\c<b\>" end="\c</b>"me=e-4 contains=@doxygenHtmlTop,doxygenHtmlItalicBoldUnderline,@Spell |
| 350 | syn region doxygenHtmlItalicBold contained start="\c<strong\>" end="\c</strong>"me=e-9 contains=@doxygenHtmlTop,doxygenHtmlItalicBoldUnderline,@Spell |
| 351 | syn region doxygenHtmlItalicBoldUnderline contained start="\c<u\>" end="\c</u>"me=e-4 contains=@doxygenHtmlTop,@Spell |
| 352 | syn region doxygenHtmlItalicUnderline contained start="\c<u\>" end="\c</u>"me=e-4 contains=@doxygenHtmlTop,doxygenHtmlItalicUnderlineBold,@Spell |
| 353 | syn region doxygenHtmlItalicUnderlineBold contained start="\c<b\>" end="\c</b>"me=e-4 contains=@doxygenHtmlTop,@Spell |
| 354 | syn region doxygenHtmlItalicUnderlineBold contained start="\c<strong\>" end="\c</strong>"me=e-9 contains=@doxygenHtmlTop,@Spell |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 355 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 356 | syn region doxygenHtmlCode contained start="\c<code\>" end="\c</code>"me=e-7 contains=@doxygenHtmlTop,@NoSpell |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 357 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 358 | " Prevent the doxygen contained matches from leaking into the c/rc groups. |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 359 | syn cluster cParenGroup add=doxygen.* |
| 360 | syn cluster cParenGroup remove=doxygenComment,doxygenCommentL |
| 361 | syn cluster cPreProcGroup add=doxygen.* |
| 362 | syn cluster cMultiGroup add=doxygen.* |
| 363 | syn cluster rcParenGroup add=doxygen.* |
| 364 | syn cluster rcParenGroup remove=doxygenComment,doxygenCommentL |
| 365 | syn cluster rcGroup add=doxygen.* |
| 366 | |
| 367 | let s:my_syncolor=0 |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 368 | if !exists(':SynColor') |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 369 | command -nargs=+ SynColor hi def <args> |
| 370 | let s:my_syncolor=1 |
| 371 | endif |
| 372 | |
| 373 | let s:my_synlink=0 |
| 374 | if !exists(':SynLink') |
| 375 | command -nargs=+ SynLink hi def link <args> |
| 376 | let s:my_synlink=1 |
| 377 | endif |
| 378 | |
| 379 | try |
| 380 | "let did_doxygen_syntax_inits = &background |
| 381 | hi doxygen_Dummy guifg=black |
| 382 | |
| 383 | fun! s:Doxygen_Hilights_Base() |
| 384 | SynLink doxygenHtmlSpecial Special |
| 385 | SynLink doxygenHtmlVar Type |
| 386 | SynLink doxygenHtmlExpr String |
| 387 | |
| 388 | SynLink doxygenSmallSpecial SpecialChar |
| 389 | |
| 390 | SynLink doxygenSpecialCodeWord doxygenSmallSpecial |
| 391 | SynLink doxygenSpecialBoldWord doxygenSmallSpecial |
| 392 | SynLink doxygenSpecialEmphasisedWord doxygenSmallSpecial |
| 393 | SynLink doxygenSpecialArgumentWord doxygenSmallSpecial |
| 394 | |
| 395 | " SynColor doxygenFormulaKeyword cterm=bold ctermfg=DarkMagenta guifg=DarkMagenta gui=bold |
| 396 | SynLink doxygenFormulaKeyword Keyword |
| 397 | "SynColor doxygenFormulaEscaped ctermfg=DarkMagenta guifg=DarkMagenta gui=bold |
| 398 | SynLink doxygenFormulaEscaped Special |
| 399 | SynLink doxygenFormulaOperator Operator |
| 400 | SynLink doxygenFormula Statement |
| 401 | SynLink doxygenSymbol Constant |
| 402 | SynLink doxygenSpecial Special |
| 403 | SynLink doxygenFormulaSpecial Special |
| 404 | "SynColor doxygenFormulaSpecial ctermfg=DarkBlue guifg=DarkBlue |
| 405 | endfun |
| 406 | call s:Doxygen_Hilights_Base() |
| 407 | |
| 408 | fun! s:Doxygen_Hilights() |
| 409 | " Pick a sensible default for 'codeword'. |
| 410 | let font='' |
| 411 | if exists('g:doxygen_codeword_font') |
| 412 | if g:doxygen_codeword_font !~ '\<\k\+=' |
| 413 | let font='font='.g:doxygen_codeword_font |
| 414 | else |
| 415 | let font=g:doxygen_codeword_font |
| 416 | endif |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 417 | else |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 418 | " Try and pick a font (only some platforms have been tested). |
| 419 | if has('gui_running') |
| 420 | if has('gui_gtk2') |
| 421 | if &guifont == '' |
| 422 | let font="font='FreeSerif 12'" |
| 423 | else |
| 424 | let font="font='".substitute(&guifont, '^.\{-}\([0-9]\+\)$', 'FreeSerif \1','')."'" |
| 425 | endif |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 426 | |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 427 | elseif has('gui_win32') || has('gui_win16') || has('gui_win95') |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 428 | |
| 429 | if exists('g:doxygen_use_bitsream_vera') && g:doxygen_use_bitsream_vera |
| 430 | let font_base='Bitstream_Vera_Sans_Mono' |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 431 | else |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 432 | let font_base='Lucida_Console' |
| 433 | endif |
| 434 | if &guifont == '' |
| 435 | let font='font='.font_base.':h10' |
| 436 | else |
| 437 | let font='font='.matchstr(substitute(&guifont, '^[^:]*', font_base,''),'[^,]*') |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 438 | endif |
| 439 | elseif has('gui_athena') || has('gui_gtk') || &guifont=~'^\(-[^-]\+\)\{14}' |
| 440 | if &guifont == '' |
| 441 | let font='font=-b&h-lucidatypewriter-medium-r-normal-*-*-140-*-*-m-*-iso8859-1' |
| 442 | else |
| 443 | " let font='font='.substitute(&guifont,'^\(-[^-]\+\)\{7}-\([0-9]\+\).*', '-b\&h-lucidatypewriter-medium-r-normal-*-*-\2-*-*-m-*-iso8859-1','') |
| 444 | " The above line works, but it is hard to expect the combination of |
| 445 | " the two fonts will look good. |
| 446 | endif |
| 447 | elseif has('gui_kde') |
| 448 | " let font='font=Bitstream\ Vera\ Sans\ Mono/12/-1/5/50/0/0/0/0/0' |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 449 | endif |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 450 | endif |
| 451 | endif |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 452 | if font=='' | let font='gui=bold' | endif |
| 453 | exe 'SynColor doxygenCodeWord term=bold cterm=bold '.font |
| 454 | if (exists('g:doxygen_enhanced_color') && g:doxygen_enhanced_color) || (exists('g:doxygen_enhanced_colour') && g:doxygen_enhanced_colour) |
| 455 | if &background=='light' |
| 456 | SynColor doxygenComment ctermfg=DarkRed guifg=DarkRed |
| 457 | SynColor doxygenBrief cterm=bold ctermfg=Cyan guifg=DarkBlue gui=bold |
| 458 | SynColor doxygenBody ctermfg=DarkBlue guifg=DarkBlue |
| 459 | SynColor doxygenSpecialTypeOnelineDesc cterm=bold ctermfg=DarkRed guifg=firebrick3 gui=bold |
| 460 | SynColor doxygenBOther cterm=bold ctermfg=DarkMagenta guifg=#aa50aa gui=bold |
| 461 | SynColor doxygenParam ctermfg=DarkGray guifg=#aa50aa |
| 462 | SynColor doxygenParamName cterm=italic ctermfg=DarkBlue guifg=DeepSkyBlue4 gui=italic,bold |
| 463 | SynColor doxygenSpecialOnelineDesc cterm=bold ctermfg=DarkCyan guifg=DodgerBlue3 gui=bold |
| 464 | SynColor doxygenSpecialHeading cterm=bold ctermfg=DarkBlue guifg=DeepSkyBlue4 gui=bold |
| 465 | SynColor doxygenPrev ctermfg=DarkGreen guifg=DarkGreen |
| 466 | else |
| 467 | SynColor doxygenComment ctermfg=LightRed guifg=LightRed |
| 468 | SynColor doxygenBrief cterm=bold ctermfg=Cyan ctermbg=darkgrey guifg=LightBlue gui=Bold,Italic |
| 469 | SynColor doxygenBody ctermfg=Cyan guifg=LightBlue |
| 470 | SynColor doxygenSpecialTypeOnelineDesc cterm=bold ctermfg=Red guifg=firebrick3 gui=bold |
| 471 | SynColor doxygenBOther cterm=bold ctermfg=Magenta guifg=#aa50aa gui=bold |
| 472 | SynColor doxygenParam ctermfg=LightGray guifg=LightGray |
| 473 | SynColor doxygenParamName cterm=italic ctermfg=LightBlue guifg=LightBlue gui=italic,bold |
| 474 | SynColor doxygenSpecialOnelineDesc cterm=bold ctermfg=LightCyan guifg=LightCyan gui=bold |
| 475 | SynColor doxygenSpecialHeading cterm=bold ctermfg=LightBlue guifg=LightBlue gui=bold |
| 476 | SynColor doxygenPrev ctermfg=LightGreen guifg=LightGreen |
| 477 | endif |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 478 | else |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 479 | SynLink doxygenComment SpecialComment |
| 480 | SynLink doxygenBrief Statement |
| 481 | SynLink doxygenBody Comment |
| 482 | SynLink doxygenSpecialTypeOnelineDesc Statement |
| 483 | SynLink doxygenBOther Constant |
| 484 | SynLink doxygenParam SpecialComment |
| 485 | SynLink doxygenParamName Underlined |
| 486 | SynLink doxygenSpecialOnelineDesc Statement |
| 487 | SynLink doxygenSpecialHeading Statement |
| 488 | SynLink doxygenPrev SpecialComment |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 489 | endif |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 490 | endfun |
| 491 | |
| 492 | call s:Doxygen_Hilights() |
| 493 | |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 494 | syn match doxygenLeadingWhite +\(^\s*\*\)\@<=\s*+ contained |
| 495 | |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 496 | " This is still a proposal, but won't do any harm. |
| 497 | aug doxygengroup |
| 498 | au! |
| 499 | au Syntax UserColor_reset nested call s:Doxygen_Hilights_Base() |
| 500 | au Syntax UserColor_{on,reset,enable} nested call s:Doxygen_Hilights() |
| 501 | aug END |
| 502 | |
| 503 | |
| 504 | SynLink doxygenBody Comment |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 505 | SynLink doxygenLine doxygenBody |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 506 | SynLink doxygenTODO Todo |
| 507 | SynLink doxygenOtherTODO Todo |
| 508 | SynLink doxygenOtherWARN Todo |
| 509 | SynLink doxygenOtherBUG Todo |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 510 | SynLink doxygenLeadingLWhite doxygenBody |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 511 | |
| 512 | SynLink doxygenErrorSpecial Error |
| 513 | SynLink doxygenErrorEnd Error |
| 514 | SynLink doxygenErrorComment Error |
| 515 | SynLink doxygenLinkError Error |
| 516 | SynLink doxygenBriefSpecial doxygenSpecial |
| 517 | SynLink doxygenHashSpecial doxygenSpecial |
| 518 | SynLink doxygenGroupDefineSpecial doxygenSpecial |
| 519 | SynLink doxygenEndlinkSpecial doxygenSpecial |
| 520 | SynLink doxygenCodeRegionSpecial doxygenSpecial |
| 521 | SynLink doxygenVerbatimRegionSpecial doxygenSpecial |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 522 | SynLink doxygenDotRegionSpecial doxygenSpecial |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 523 | SynLink doxygenGroupDefine doxygenParam |
| 524 | |
| 525 | SynLink doxygenSpecialMultilineDesc doxygenSpecialOnelineDesc |
| 526 | SynLink doxygenFormulaEnds doxygenSpecial |
| 527 | SynLink doxygenBold doxygenParam |
| 528 | SynLink doxygenBriefWord doxygenParam |
| 529 | SynLink doxygenRetval doxygenParam |
| 530 | SynLink doxygenOther doxygenParam |
| 531 | SynLink doxygenStart doxygenComment |
| 532 | SynLink doxygenStart2 doxygenStart |
| 533 | SynLink doxygenComment2 doxygenComment |
| 534 | SynLink doxygenCommentL doxygenComment |
| 535 | SynLink doxygenContinueComment doxygenComment |
| 536 | SynLink doxygenSpecialContinueComment doxygenComment |
| 537 | SynLink doxygenSkipComment doxygenComment |
| 538 | SynLink doxygenEndComment doxygenComment |
| 539 | SynLink doxygenStartL doxygenComment |
| 540 | SynLink doxygenBriefEndComment doxygenComment |
| 541 | SynLink doxygenPrevL doxygenPrev |
| 542 | SynLink doxygenBriefL doxygenBrief |
| 543 | SynLink doxygenBriefLine doxygenBrief |
| 544 | SynLink doxygenHeaderLine doxygenSpecialHeading |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 545 | SynLink doxygenCommentWhite Normal |
| 546 | SynLink doxygenCommentWhite2 doxygenCommentWhite |
| 547 | SynLink doxygenContinueCommentWhite doxygenCommentWhite |
| 548 | SynLink doxygenStartSkipWhite doxygenContinueCommentWhite |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 549 | SynLink doxygenLinkWord doxygenParamName |
| 550 | SynLink doxygenLinkRest doxygenSpecialMultilineDesc |
| 551 | SynLink doxygenHyperLink doxygenLinkWord |
| 552 | SynLink doxygenHashLink doxygenLinkWord |
| 553 | |
| 554 | SynLink doxygenPage doxygenSpecial |
| 555 | SynLink doxygenPagePage doxygenBOther |
| 556 | SynLink doxygenPageIdent doxygenParamName |
| 557 | SynLink doxygenPageDesc doxygenSpecialTypeOnelineDesc |
| 558 | |
| 559 | SynLink doxygenSpecialIdent doxygenPageIdent |
| 560 | SynLink doxygenSpecialSectionDesc doxygenSpecialMultilineDesc |
| 561 | |
| 562 | SynLink doxygenSpecialRefWord doxygenOther |
| 563 | SynLink doxygenRefWord doxygenPageIdent |
| 564 | SynLink doxygenContinueLinkComment doxygenComment |
| 565 | |
| 566 | SynLink doxygenHtmlCh Function |
| 567 | SynLink doxygenHtmlCmd Statement |
| 568 | SynLink doxygenHtmlBoldItalicUnderline doxygenHtmlBoldUnderlineItalic |
| 569 | SynLink doxygenHtmlUnderlineBold doxygenHtmlBoldUnderline |
| 570 | SynLink doxygenHtmlUnderlineItalicBold doxygenHtmlBoldUnderlineItalic |
| 571 | SynLink doxygenHtmlUnderlineBoldItalic doxygenHtmlBoldUnderlineItalic |
| 572 | SynLink doxygenHtmlItalicUnderline doxygenHtmlUnderlineItalic |
| 573 | SynLink doxygenHtmlItalicBold doxygenHtmlBoldItalic |
| 574 | SynLink doxygenHtmlItalicBoldUnderline doxygenHtmlBoldUnderlineItalic |
| 575 | SynLink doxygenHtmlItalicUnderlineBold doxygenHtmlBoldUnderlineItalic |
| 576 | SynLink doxygenHtmlLink Underlined |
| 577 | |
| 578 | SynLink doxygenParamDirection StorageClass |
| 579 | |
| 580 | |
| 581 | if !exists("doxygen_my_rendering") && !exists("html_my_rendering") |
| 582 | SynColor doxygenBoldWord term=bold cterm=bold gui=bold |
| 583 | SynColor doxygenEmphasisedWord term=italic cterm=italic gui=italic |
| 584 | SynLink doxygenArgumentWord doxygenEmphasisedWord |
| 585 | SynLink doxygenHtmlCode doxygenCodeWord |
| 586 | SynLink doxygenHtmlBold doxygenBoldWord |
| 587 | SynColor doxygenHtmlBoldUnderline term=bold,underline cterm=bold,underline gui=bold,underline |
| 588 | SynColor doxygenHtmlBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic |
| 589 | SynColor doxygenHtmlBoldUnderlineItalic term=bold,italic,underline cterm=bold,italic,underline gui=bold,italic,underline |
| 590 | SynColor doxygenHtmlUnderline term=underline cterm=underline gui=underline |
| 591 | SynColor doxygenHtmlUnderlineItalic term=italic,underline cterm=italic,underline gui=italic,underline |
| 592 | SynColor doxygenHtmlItalic term=italic cterm=italic gui=italic |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 593 | endif |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 594 | |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 595 | finally |
| 596 | if s:my_synlink | delcommand SynLink | endif |
| 597 | if s:my_syncolor | delcommand SynColor | endif |
| 598 | endtry |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 599 | |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 600 | if &syntax=='idl' |
| 601 | syn cluster idlCommentable add=doxygenComment,doxygenCommentL |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 602 | endif |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 603 | |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 604 | "syn sync clear |
| 605 | "syn sync maxlines=500 |
| 606 | "syn sync minlines=50 |
| 607 | syn sync match doxygenComment groupthere cComment "/\@<!/\*" |
| 608 | syn sync match doxygenSyncComment grouphere doxygenComment "/\@<!/\*[*!]" |
| 609 | "syn sync match doxygenSyncComment grouphere doxygenComment "/\*[*!]" contains=doxygenStart,doxygenTODO keepend |
| 610 | syn sync match doxygenSyncEndComment groupthere NONE "\*/" |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 611 | |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 612 | if !exists('b:current_syntax') |
| 613 | let b:current_syntax = "doxygen" |
| 614 | else |
| 615 | let b:current_syntax = b:current_syntax.'.doxygen' |
| 616 | endif |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 617 | |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 618 | finally |
| 619 | let &cpo = s:cpo_save |
| 620 | unlet s:cpo_save |
| 621 | endtry |
Bram Moolenaar | a2a8016 | 2017-11-21 23:09:50 +0100 | [diff] [blame] | 622 | let suppress_doxygen=1 |
Bram Moolenaar | c6249bb | 2006-04-15 20:25:09 +0000 | [diff] [blame] | 623 | " vim:et sw=2 sts=2 |