blob: 67a627e46ce56c60475504d96e15bdcc8b56df8c [file] [log] [blame]
Bram Moolenaar40962ec2018-01-28 22:47:25 +01001" 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
10if exists("b:current_syntax")
11 finish
12endif
13
14let s:cpo_save = &cpo
15set cpo&vim
16
17syn case match
18
19" A bunch of useful autodoc keywords
20syn keyword autodocStatement contained appears belongs global
21syn keyword autodocStatement contained decl directive inherit
22syn keyword autodocStatement contained deprecated obsolete bugs
23syn keyword autodocStatement contained copyright example fixme note param returns
24syn keyword autodocStatement contained seealso thanks throws constant
25syn keyword autodocStatement contained member index elem
26syn keyword autodocStatement contained value type item
27
28syn keyword autodocRegion contained enum mapping code multiset array
29syn keyword autodocRegion contained int string section mixed ol ul dl
30syn keyword autodocRegion contained class module namespace
31syn keyword autodocRegion contained endenum endmapping endcode endmultiset
32syn keyword autodocRegion contained endarray endint endstring endsection
33syn keyword autodocRegion contained endmixed endol endul enddl
34syn keyword autodocRegion contained endclass endmodule endnamespace
35
36syn keyword autodocIgnore contained ignore endignore
37
38syn keyword autodocStatAcc contained b i u tt url pre sub sup
39syn keyword autodocStatAcc contained ref rfc xml dl expr image
40
41syn keyword autodocTodo contained TODO FIXME XXX
42
43syn match autodocLineStart display "\(//\|/\?\*\)\@2<=!"
44syn match autodocWords "[^!@{}[\]]\+" display contains=@Spell
45
46syn match autodocLink "@\[[^[\]]\+]"hs=s+2,he=e-1 display contains=autodocLead
47syn 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
51syn region autodocNStmtAcc start="@[a-z]\+{" end="@}" contains=autodocStatAcc,autodocLead keepend
52
53syn match autodocUrl contained display ".\+"
54syn region autodocAtUrlAcc start="{"ms=s+1 end="@}"he=e-1,me=e-2 contained display contains=autodocUrl,autodocLead keepend
55syn region autodocNUrlAcc start="@url{" end="@}" contains=autodocStatAcc,autodocAtUrlAcc,autodocLead transparent
56
57syn match autodocSpecial "@@" display
58syn match autodocLead "@" display contained
59
60"when wanted, highlight trailing white space
61if 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
68endif
69
70if exists("c_minlines")
71 let b:c_minlines = c_minlines
72else
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
78endif
79exec "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
83hi def link autodocStatement Statement
84hi def link autodocStatAcc Statement
85hi def link autodocRegion Structure
86hi def link autodocAtStmt Error
87hi def link autodocNStmtAcc Identifier
88hi def link autodocLink Type
89hi def link autodocTodo Todo
90hi def link autodocSpaceError Error
91hi def link autodocLineStart SpecialComment
92hi def link autodocSpecial SpecialChar
93hi def link autodocUrl Underlined
94hi def link autodocLead Statement
95hi def link autodocIgnore Delimiter
96
97let b:current_syntax = "autodoc"
98
99let &cpo = s:cpo_save
100unlet s:cpo_save
101" vim: ts=8