1" Vim syntax file
2" Language:         denyhosts configuration file
3" Maintainer:       Nikolai Weibull <now@bitwi.se>
4" Latest Revision:  2007-06-25
5
6if exists("b:current_syntax")
7  finish
8endif
9
10let s:cpo_save = &cpo
11set cpo&vim
12
13syn keyword denyhostsTodo
14      \ contained
15      \ TODO
16      \ FIXME
17      \ XXX
18      \ NOTE
19
20syn case ignore
21
22syn match   denyhostsComment
23      \ contained
24      \ display
25      \ '#.*'
26      \ contains=denyhostsTodo,
27      \          @Spell
28
29syn match   denyhostsBegin
30      \ display
31      \ '^'
32      \ nextgroup=@denyhostsSetting,
33      \           denyhostsComment
34      \ skipwhite
35
36syn cluster denyhostsSetting
37      \ contains=denyhostsStringSetting,
38      \          denyhostsBooleanSetting,
39      \          denyhostsPathSetting,
40      \          denyhostsNumericSetting,
41      \          denyhostsTimespecSetting,
42      \          denyhostsFormatSetting,
43      \          denyhostsRegexSetting
44
45syn keyword denyhostsStringSetting
46      \ contained
47      \ ADMIN_EMAIL
48      \ SMTP_HOST
49      \ SMTP_USERNAME
50      \ SMTP_PASSWORD
51      \ SMTP_FROM
52      \ SMTP_SUBJECT
53      \ BLOCK_SERVICE
54      \ nextgroup=denyhostsStringDelimiter
55      \ skipwhite
56
57syn keyword denyhostsBooleanSetting
58      \ contained
59      \ SUSPICIOUS_LOGIN_REPORT_ALLOWED_HOSTS
60      \ HOSTNAME_LOOKUP
61      \ SYSLOG_REPORT
62      \ RESET_ON_SUCCESS
63      \ SYNC_UPLOAD
64      \ SYNC_DOWNLOAD
65      \ ALLOWED_HOSTS_HOSTNAME_LOOKUP
66      \ nextgroup=denyhostsBooleanDelimiter
67      \ skipwhite
68
69syn keyword denyhostsPathSetting
70      \ contained
71      \ DAEMON_LOG
72      \ PLUGIN_DENY
73      \ PLUGIN_PURGE
74      \ SECURE_LOG
75      \ LOCK_FILE
76      \ HOSTS_DENY
77      \ WORK_DIR
78      \ nextgroup=denyhostsPathDelimiter
79      \ skipwhite
80
81syn keyword denyhostsNumericSetting
82      \ contained
83      \ SYNC_DOWNLOAD_THRESHOLD
84      \ SMTP_PORT
85      \ PURGE_THRESHOLD
86      \ DENY_THRESHOLD_INVALID
87      \ DENY_THRESHOLD_VALID
88      \ DENY_THRESHOLD_ROOT
89      \ DENY_THRESHOLD_RESTRICTED
90      \ nextgroup=denyhostsNumericDelimiter
91      \ skipwhite
92
93syn keyword denyhostsTimespecSetting
94      \ contained
95      \ DAEMON_SLEEP
96      \ DAEMON_PURGE
97      \ AGE_RESET_INVALID
98      \ AGE_RESET_VALID
99      \ AGE_RESET_ROOT
100      \ AGE_RESET_RESTRICTED
101      \ SYNC_INTERVAL
102      \ SYNC_DOWNLOAD_RESILIENCY
103      \ PURGE_DENY
104      \ nextgroup=denyhostsTimespecDelimiter
105      \ skipwhite
106
107syn keyword denyhostsFormatSetting
108      \ contained
109      \ DAEMON_LOG_TIME_FORMAT
110      \ DAEMON_LOG_MESSAGE_FORMAT
111      \ SMTP_DATE_FORMAT
112      \ nextgroup=denyhostsFormatDelimiter
113      \ skipwhite
114
115syn keyword denyhostsRegexSetting
116      \ contained
117      \ SSHD_FORMAT_REGEX
118      \ FAILED_ENTRY_REGEX
119      \ FAILED_ENTRY_REGEX2
120      \ FAILED_ENTRY_REGEX3
121      \ FAILED_ENTRY_REGEX4
122      \ FAILED_ENTRY_REGEX5
123      \ FAILED_ENTRY_REGEX6
124      \ FAILED_ENTRY_REGEX7
125      \ USERDEF_FAILED_ENTRY_REGEX
126      \ SUCCESSFUL_ENTRY_REGEX
127      \ nextgroup=denyhostsRegexDelimiter
128      \ skipwhite
129
130syn keyword denyhostURLSetting
131      \ contained
132      \ SYNC_SERVER
133      \ nextgroup=denyhostsURLDelimiter
134      \ skipwhite
135
136syn match   denyhostsStringDelimiter
137      \ contained
138      \ display
139      \ '[:=]'
140      \ nextgroup=denyhostsString
141      \ skipwhite
142
143syn match   denyhostsBooleanDelimiter
144      \ contained
145      \ display
146      \ '[:=]'
147      \ nextgroup=@denyhostsBoolean
148      \ skipwhite
149
150syn match   denyhostsPathDelimiter
151      \ contained
152      \ display
153      \ '[:=]'
154      \ nextgroup=denyhostsPath
155      \ skipwhite
156
157syn match   denyhostsNumericDelimiter
158      \ contained
159      \ display
160      \ '[:=]'
161      \ nextgroup=denyhostsNumber
162      \ skipwhite
163
164syn match   denyhostsTimespecDelimiter
165      \ contained
166      \ display
167      \ '[:=]'
168      \ nextgroup=denyhostsTimespec
169      \ skipwhite
170
171syn match   denyhostsFormatDelimiter
172      \ contained
173      \ display
174      \ '[:=]'
175      \ nextgroup=denyhostsFormat
176      \ skipwhite
177
178syn match   denyhostsRegexDelimiter
179      \ contained
180      \ display
181      \ '[:=]'
182      \ nextgroup=denyhostsRegex
183      \ skipwhite
184
185syn match   denyhostsURLDelimiter
186      \ contained
187      \ display
188      \ '[:=]'
189      \ nextgroup=denyhostsURL
190      \ skipwhite
191
192syn match   denyhostsString
193      \ contained
194      \ display
195      \ '.\+'
196
197syn cluster denyhostsBoolean
198      \ contains=denyhostsBooleanTrue,
199      \          denyhostsBooleanFalse
200
201syn match   denyhostsBooleanFalse
202      \ contained
203      \ display
204      \ '.\+'
205
206syn match   denyhostsBooleanTrue
207      \ contained
208      \ display
209      \ '\s*\%(1\|t\%(rue\)\=\|y\%(es\)\=\)\>\s*$'
210
211syn match   denyhostsPath
212      \ contained
213      \ display
214      \ '.\+'
215
216syn match   denyhostsNumber
217      \ contained
218      \ display
219      \ '\d\+\>'
220
221syn match   denyhostsTimespec
222      \ contained
223      \ display
224      \ '\d\+[mhdwy]\>'
225
226syn match   denyhostsFormat
227      \ contained
228      \ display
229      \ '.\+'
230      \ contains=denyhostsFormattingExpandos
231
232syn match   denyhostsFormattingExpandos
233      \ contained
234      \ display
235      \ '%.'
236
237syn match   denyhostsRegex
238      \ contained
239      \ display
240      \ '.\+'
241
242" TODO: Perhaps come up with a better regex here?  There should really be a
243" library for these kinds of generic regexes, that is, URLs, mail addresses, …
244syn match   denyhostsURL
245      \ contained
246      \ display
247      \ '.\+'
248
249hi def link denyhostsTodo               Todo
250hi def link denyhostsComment            Comment
251hi def link denyhostsSetting            Keyword
252hi def link denyhostsStringSetting      denyhostsSetting
253hi def link denyhostsBooleanSetting     denyhostsSetting
254hi def link denyhostsPathSetting        denyhostsSetting
255hi def link denyhostsNumericSetting     denyhostsSetting
256hi def link denyhostsTimespecSetting    denyhostsSetting
257hi def link denyhostsFormatSetting      denyhostsSetting
258hi def link denyhostsRegexSetting       denyhostsSetting
259hi def link denyhostURLSetting          denyhostsSetting
260hi def link denyhostsDelimiter          Normal
261hi def link denyhostsStringDelimiter    denyhostsDelimiter
262hi def link denyhostsBooleanDelimiter   denyhostsDelimiter
263hi def link denyhostsPathDelimiter      denyhostsDelimiter
264hi def link denyhostsNumericDelimiter   denyhostsDelimiter
265hi def link denyhostsTimespecDelimiter  denyhostsDelimiter
266hi def link denyhostsFormatDelimiter    denyhostsDelimiter
267hi def link denyhostsRegexDelimiter     denyhostsDelimiter
268hi def link denyhostsURLDelimiter       denyhostsDelimiter
269hi def link denyhostsString             String
270if exists('g:syntax_booleans_simple') || exists('b:syntax_booleans_simple')
271  hi def link denyhostsBoolean          Boolean
272  hi def link denyhostsBooleanFalse     denyhostsBoolean
273  hi def link denyhostsBooleanTrue      denyhostsBoolean
274else
275  hi def    denyhostsBooleanTrue        term=bold ctermfg=Green guifg=Green
276  hi def    denyhostsBooleanFalse       ctermfg=Red guifg=Red
277endif
278hi def link denyhostsPath               String
279hi def link denyhostsNumber             Number
280hi def link denyhostsTimespec           Number
281hi def link denyhostsFormat             String
282hi def link denyhostsFormattingExpandos Special
283hi def link denyhostsRegex              String
284hi def link denyhostsURL                String
285
286let b:current_syntax = "denyhosts"
287
288let &cpo = s:cpo_save
289unlet s:cpo_save
290