2
" Language: host.conf(5) configuration file
3
" Maintainer: Nikolai Weibull <now@bitwi.se>
4
" Latest Revision: 2007-06-25
6
if exists("b:current_syntax")
13
syn keyword hostconfTodo
20
syn match hostconfComment
24
\ contains=hostconfTodo,
27
syn match hostconfBegin
30
\ nextgroup=hostconfComment,hostconfKeyword
33
syn keyword hostconfKeyword
36
\ nextgroup=hostconfLookupOrder
39
let s:orders = ['bind', 'hosts', 'nis']
41
function s:permute_suffixes(list)
44
elseif len(a:list) == 1
49
let sub_permutations = []
51
let list_copy = copy(a:list)
52
let removed = list_copy[i]
53
call remove(list_copy, i)
54
call add(sub_permutations, [removed, s:permute_suffixes(list_copy)])
57
return sub_permutations
61
function s:generate_suffix_groups(list_of_order_of_orders, context, trailing_context)
62
for order_of_orders in a:list_of_order_of_orders
63
let order = order_of_orders[0]
64
let trailing_context = a:trailing_context . toupper(order[0]) . order[1:]
65
let nextgroup = 'hostconfLookupOrder' . trailing_context
66
let nextgroup_delimiter = nextgroup . 'Delimiter'
67
let group = 'hostconfLookupOrder' . a:context
68
execute 'syn keyword' group 'contained' order 'nextgroup=' . nextgroup_delimiter 'skipwhite'
69
execute 'syn match' nextgroup_delimiter 'contained display "," nextgroup=' . nextgroup 'skipwhite'
71
execute 'hi def link' group 'hostconfLookupOrder'
73
execute 'hi def link' nextgroup_delimiter 'hostconfLookupOrderDelimiter'
74
let context = trailing_context
75
if type(order_of_orders[1]) == type([])
76
call s:generate_suffix_groups(order_of_orders[1], context, trailing_context)
78
execute 'syn keyword hostconfLookupOrder' . context 'contained' order_of_orders[-1]
79
execute 'hi def link hostconfLookupOrder' . context 'hostconfLookupOrder'
84
call s:generate_suffix_groups(s:permute_suffixes(s:orders), "", "")
86
delfunction s:generate_suffix_groups
87
delfunction s:permute_suffixes
89
syn keyword hostconfKeyword
92
\ nextgroup=hostconfDomain
95
syn match hostconfDomain
97
\ '\.[^:;,[:space:]]\+'
98
\ nextgroup=hostconfDomainDelimiter
101
syn match hostconfDomainDelimiter
105
\ nextgroup=hostconfDomain
108
syn keyword hostconfKeyword
114
\ nextgroup=hostconfBoolean
117
syn keyword hostconfBoolean
122
syn keyword hostconfKeyword
125
\ nextgroup=hostconfSpoofValue
128
syn keyword hostconfSpoofValue
134
hi def link hostconfTodo Todo
135
hi def link hostconfComment Comment
136
hi def link hostconfKeyword Keyword
137
hi def link hostconfLookupOrder Identifier
138
hi def link hostconfLookupOrderDelimiter Delimiter
139
hi def link hostconfDomain String
140
hi def link hostconfDomainDelimiter Delimiter
141
hi def link hostconfBoolean Boolean
142
hi def link hostconfSpoofValue hostconfBoolean
144
let b:current_syntax = "hostconf"
146
let &cpo = s:cpo_save