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