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