summaryrefslogtreecommitdiff
path: root/runtime/syntax/denyhosts.vim
blob: 0ec09ba13efb4f7d424df6358c1e5953796c0639 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
" Vim syntax file
" Language:         denyhosts configuration file
" Maintainer:       Nikolai Weibull <now@bitwi.se>
" Latest Revision:  2007-06-25

if exists("b:current_syntax")
  finish
endif

let s:cpo_save = &cpo
set cpo&vim

syn keyword denyhostsTodo
      \ contained
      \ TODO
      \ FIXME
      \ XXX
      \ NOTE

syn case ignore

syn match   denyhostsComment
      \ contained
      \ display
      \ '#.*'
      \ contains=denyhostsTodo,
      \          @Spell

syn match   denyhostsBegin
      \ display
      \ '^'
      \ nextgroup=@denyhostsSetting,
      \           denyhostsComment
      \ skipwhite

syn cluster denyhostsSetting
      \ contains=denyhostsStringSetting,
      \          denyhostsBooleanSetting,
      \          denyhostsPathSetting,
      \          denyhostsNumericSetting,
      \          denyhostsTimespecSetting,
      \          denyhostsFormatSetting,
      \          denyhostsRegexSetting

syn keyword denyhostsStringSetting
      \ contained
      \ ADMIN_EMAIL
      \ SMTP_HOST
      \ SMTP_USERNAME
      \ SMTP_PASSWORD
      \ SMTP_FROM
      \ SMTP_SUBJECT
      \ BLOCK_SERVICE
      \ nextgroup=denyhostsStringDelimiter
      \ skipwhite

syn keyword denyhostsBooleanSetting
      \ contained
      \ SUSPICIOUS_LOGIN_REPORT_ALLOWED_HOSTS
      \ HOSTNAME_LOOKUP
      \ SYSLOG_REPORT
      \ RESET_ON_SUCCESS
      \ SYNC_UPLOAD
      \ SYNC_DOWNLOAD
      \ ALLOWED_HOSTS_HOSTNAME_LOOKUP
      \ nextgroup=denyhostsBooleanDelimiter
      \ skipwhite

syn keyword denyhostsPathSetting
      \ contained
      \ DAEMON_LOG
      \ PLUGIN_DENY
      \ PLUGIN_PURGE
      \ SECURE_LOG
      \ LOCK_FILE
      \ HOSTS_DENY
      \ WORK_DIR
      \ nextgroup=denyhostsPathDelimiter
      \ skipwhite

syn keyword denyhostsNumericSetting
      \ contained
      \ SYNC_DOWNLOAD_THRESHOLD
      \ SMTP_PORT
      \ PURGE_THRESHOLD
      \ DENY_THRESHOLD_INVALID
      \ DENY_THRESHOLD_VALID
      \ DENY_THRESHOLD_ROOT
      \ DENY_THRESHOLD_RESTRICTED
      \ nextgroup=denyhostsNumericDelimiter
      \ skipwhite

syn keyword denyhostsTimespecSetting
      \ contained
      \ DAEMON_SLEEP
      \ DAEMON_PURGE
      \ AGE_RESET_INVALID
      \ AGE_RESET_VALID
      \ AGE_RESET_ROOT
      \ AGE_RESET_RESTRICTED
      \ SYNC_INTERVAL
      \ SYNC_DOWNLOAD_RESILIENCY
      \ PURGE_DENY
      \ nextgroup=denyhostsTimespecDelimiter
      \ skipwhite

syn keyword denyhostsFormatSetting
      \ contained
      \ DAEMON_LOG_TIME_FORMAT
      \ DAEMON_LOG_MESSAGE_FORMAT
      \ SMTP_DATE_FORMAT
      \ nextgroup=denyhostsFormatDelimiter
      \ skipwhite

syn keyword denyhostsRegexSetting
      \ contained
      \ SSHD_FORMAT_REGEX
      \ FAILED_ENTRY_REGEX
      \ FAILED_ENTRY_REGEX2
      \ FAILED_ENTRY_REGEX3
      \ FAILED_ENTRY_REGEX4
      \ FAILED_ENTRY_REGEX5
      \ FAILED_ENTRY_REGEX6
      \ FAILED_ENTRY_REGEX7
      \ USERDEF_FAILED_ENTRY_REGEX
      \ SUCCESSFUL_ENTRY_REGEX
      \ nextgroup=denyhostsRegexDelimiter
      \ skipwhite

syn keyword denyhostURLSetting
      \ contained
      \ SYNC_SERVER
      \ nextgroup=denyhostsURLDelimiter
      \ skipwhite

syn match   denyhostsStringDelimiter
      \ contained
      \ display
      \ '[:=]'
      \ nextgroup=denyhostsString
      \ skipwhite

syn match   denyhostsBooleanDelimiter
      \ contained
      \ display
      \ '[:=]'
      \ nextgroup=@denyhostsBoolean
      \ skipwhite

syn match   denyhostsPathDelimiter
      \ contained
      \ display
      \ '[:=]'
      \ nextgroup=denyhostsPath
      \ skipwhite

syn match   denyhostsNumericDelimiter
      \ contained
      \ display
      \ '[:=]'
      \ nextgroup=denyhostsNumber
      \ skipwhite

syn match   denyhostsTimespecDelimiter
      \ contained
      \ display
      \ '[:=]'
      \ nextgroup=denyhostsTimespec
      \ skipwhite

syn match   denyhostsFormatDelimiter
      \ contained
      \ display
      \ '[:=]'
      \ nextgroup=denyhostsFormat
      \ skipwhite

syn match   denyhostsRegexDelimiter
      \ contained
      \ display
      \ '[:=]'
      \ nextgroup=denyhostsRegex
      \ skipwhite

syn match   denyhostsURLDelimiter
      \ contained
      \ display
      \ '[:=]'
      \ nextgroup=denyhostsURL
      \ skipwhite

syn match   denyhostsString
      \ contained
      \ display
      \ '.\+'

syn cluster denyhostsBoolean
      \ contains=denyhostsBooleanTrue,
      \          denyhostsBooleanFalse

syn match   denyhostsBooleanFalse
      \ contained
      \ display
      \ '.\+'

syn match   denyhostsBooleanTrue
      \ contained
      \ display
      \ '\s*\%(1\|t\%(rue\)\=\|y\%(es\)\=\)\>\s*$'

syn match   denyhostsPath
      \ contained
      \ display
      \ '.\+'

syn match   denyhostsNumber
      \ contained
      \ display
      \ '\d\+\>'

syn match   denyhostsTimespec
      \ contained
      \ display
      \ '\d\+[mhdwy]\>'

syn match   denyhostsFormat
      \ contained
      \ display
      \ '.\+'
      \ contains=denyhostsFormattingExpandos

syn match   denyhostsFormattingExpandos
      \ contained
      \ display
      \ '%.'

syn match   denyhostsRegex
      \ contained
      \ display
      \ '.\+'

" TODO: Perhaps come up with a better regex here?  There should really be a
" library for these kinds of generic regexes, that is, URLs, mail addresses, …
syn match   denyhostsURL
      \ contained
      \ display
      \ '.\+'

hi def link denyhostsTodo               Todo
hi def link denyhostsComment            Comment
hi def link denyhostsSetting            Keyword
hi def link denyhostsStringSetting      denyhostsSetting
hi def link denyhostsBooleanSetting     denyhostsSetting
hi def link denyhostsPathSetting        denyhostsSetting
hi def link denyhostsNumericSetting     denyhostsSetting
hi def link denyhostsTimespecSetting    denyhostsSetting
hi def link denyhostsFormatSetting      denyhostsSetting
hi def link denyhostsRegexSetting       denyhostsSetting
hi def link denyhostURLSetting          denyhostsSetting
hi def link denyhostsDelimiter          Normal
hi def link denyhostsStringDelimiter    denyhostsDelimiter
hi def link denyhostsBooleanDelimiter   denyhostsDelimiter
hi def link denyhostsPathDelimiter      denyhostsDelimiter
hi def link denyhostsNumericDelimiter   denyhostsDelimiter
hi def link denyhostsTimespecDelimiter  denyhostsDelimiter
hi def link denyhostsFormatDelimiter    denyhostsDelimiter
hi def link denyhostsRegexDelimiter     denyhostsDelimiter
hi def link denyhostsURLDelimiter       denyhostsDelimiter
hi def link denyhostsString             String
if exists('g:syntax_booleans_simple') || exists('b:syntax_booleans_simple')
  hi def link denyhostsBoolean          Boolean
  hi def link denyhostsBooleanFalse     denyhostsBoolean
  hi def link denyhostsBooleanTrue      denyhostsBoolean
else
  hi def    denyhostsBooleanTrue        term=bold ctermfg=Green guifg=Green
  hi def    denyhostsBooleanFalse       ctermfg=Red guifg=Red
endif
hi def link denyhostsPath               String
hi def link denyhostsNumber             Number
hi def link denyhostsTimespec           Number
hi def link denyhostsFormat             String
hi def link denyhostsFormattingExpandos Special
hi def link denyhostsRegex              String
hi def link denyhostsURL                String

let b:current_syntax = "denyhosts"

let &cpo = s:cpo_save
unlet s:cpo_save