13125
|
1 " Vim syntax file
|
|
2 " Language: Autodoc
|
|
3 " Maintainer: Stephen R. van den Berg <srb@cuci.nl>
|
|
4 " Last Change: 2018 Jan 23
|
|
5 " Version: 2.9
|
|
6 " Remark: Included by pike.vim, cmod.vim and optionally c.vim
|
|
7 " Remark: In order to make c.vim use it, set: c_autodoc
|
|
8
|
|
9 " Quit when a (custom) syntax file was already loaded
|
|
10 if exists("b:current_syntax")
|
|
11 finish
|
|
12 endif
|
|
13
|
|
14 let s:cpo_save = &cpo
|
|
15 set cpo&vim
|
|
16
|
|
17 syn case match
|
|
18
|
|
19 " A bunch of useful autodoc keywords
|
|
20 syn keyword autodocStatement contained appears belongs global
|
|
21 syn keyword autodocStatement contained decl directive inherit
|
|
22 syn keyword autodocStatement contained deprecated obsolete bugs
|
|
23 syn keyword autodocStatement contained copyright example fixme note param returns
|
|
24 syn keyword autodocStatement contained seealso thanks throws constant
|
|
25 syn keyword autodocStatement contained member index elem
|
|
26 syn keyword autodocStatement contained value type item
|
|
27
|
|
28 syn keyword autodocRegion contained enum mapping code multiset array
|
|
29 syn keyword autodocRegion contained int string section mixed ol ul dl
|
|
30 syn keyword autodocRegion contained class module namespace
|
|
31 syn keyword autodocRegion contained endenum endmapping endcode endmultiset
|
|
32 syn keyword autodocRegion contained endarray endint endstring endsection
|
|
33 syn keyword autodocRegion contained endmixed endol endul enddl
|
|
34 syn keyword autodocRegion contained endclass endmodule endnamespace
|
|
35
|
|
36 syn keyword autodocIgnore contained ignore endignore
|
|
37
|
|
38 syn keyword autodocStatAcc contained b i u tt url pre sub sup
|
|
39 syn keyword autodocStatAcc contained ref rfc xml dl expr image
|
|
40
|
|
41 syn keyword autodocTodo contained TODO FIXME XXX
|
|
42
|
|
43 syn match autodocLineStart display "\(//\|/\?\*\)\@2<=!"
|
|
44 syn match autodocWords "[^!@{}[\]]\+" display contains=@Spell
|
|
45
|
|
46 syn match autodocLink "@\[[^[\]]\+]"hs=s+2,he=e-1 display contains=autodocLead
|
|
47 syn match autodocAtStmt "@[a-z]\+\%(\s\|$\)\@="hs=s+1 display contains=autodocStatement,autodocIgnore,autodocLead,autodocRegion
|
|
48
|
|
49 " Due to limitations of the matching algorithm, we cannot highlight
|
|
50 " nested autodocNStmtAcc structures correctly
|
|
51 syn region autodocNStmtAcc start="@[a-z]\+{" end="@}" contains=autodocStatAcc,autodocLead keepend
|
|
52
|
|
53 syn match autodocUrl contained display ".\+"
|
|
54 syn region autodocAtUrlAcc start="{"ms=s+1 end="@}"he=e-1,me=e-2 contained display contains=autodocUrl,autodocLead keepend
|
|
55 syn region autodocNUrlAcc start="@url{" end="@}" contains=autodocStatAcc,autodocAtUrlAcc,autodocLead transparent
|
|
56
|
|
57 syn match autodocSpecial "@@" display
|
|
58 syn match autodocLead "@" display contained
|
|
59
|
|
60 "when wanted, highlight trailing white space
|
|
61 if exists("c_space_errors")
|
|
62 if !exists("c_no_trail_space_error")
|
|
63 syn match autodocSpaceError display excludenl "\s\+$"
|
|
64 endif
|
|
65 if !exists("c_no_tab_space_error")
|
|
66 syn match autodocSpaceError display " \+\t"me=e-1
|
|
67 endif
|
|
68 endif
|
|
69
|
|
70 if exists("c_minlines")
|
|
71 let b:c_minlines = c_minlines
|
|
72 else
|
|
73 if !exists("c_no_if0")
|
|
74 let b:c_minlines = 50 " #if 0 constructs can be long
|
|
75 else
|
|
76 let b:c_minlines = 15 " mostly for () constructs
|
|
77 endif
|
|
78 endif
|
|
79 exec "syn sync ccomment autodocComment minlines=" . b:c_minlines
|
|
80
|
|
81 " Define the default highlighting.
|
|
82 " Only used when an item doesn't have highlighting yet
|
|
83 hi def link autodocStatement Statement
|
|
84 hi def link autodocStatAcc Statement
|
|
85 hi def link autodocRegion Structure
|
|
86 hi def link autodocAtStmt Error
|
|
87 hi def link autodocNStmtAcc Identifier
|
|
88 hi def link autodocLink Type
|
|
89 hi def link autodocTodo Todo
|
|
90 hi def link autodocSpaceError Error
|
|
91 hi def link autodocLineStart SpecialComment
|
|
92 hi def link autodocSpecial SpecialChar
|
|
93 hi def link autodocUrl Underlined
|
|
94 hi def link autodocLead Statement
|
|
95 hi def link autodocIgnore Delimiter
|
|
96
|
|
97 let b:current_syntax = "autodoc"
|
|
98
|
|
99 let &cpo = s:cpo_save
|
|
100 unlet s:cpo_save
|
|
101 " vim: ts=8
|