annotate runtime/syntax/hostconf.vim @ 5322:9801d06e7b4c v7.4.014

updated for version 7.4.014 Problem: MS-Windows: check for writing to device does not work. Solution: Fix #ifdefs. (Ken Takata)
author Bram Moolenaar <bram@vim.org>
date Fri, 30 Aug 2013 17:07:01 +0200
parents 18ee39301b82
children 1218c5353e2b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
1 " Vim syntax file
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
2 " Language: host.conf(5) configuration file
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
3 " Maintainer: Nikolai Weibull <now@bitwi.se>
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
4 " Latest Revision: 2007-06-25
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
5
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
6 if exists("b:current_syntax")
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
7 finish
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
8 endif
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
9
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
10 let s:cpo_save = &cpo
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
11 set cpo&vim
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
12
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
13 syn keyword hostconfTodo
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
14 \ contained
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
15 \ TODO
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
16 \ FIXME
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
17 \ XXX
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
18 \ NOTE
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
19
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
20 syn match hostconfComment
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
21 \ display
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
22 \ contained
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
23 \ '\s*#.*'
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
24 \ contains=hostconfTodo,
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
25 \ @Spell
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
26
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
27 syn match hostconfBegin
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
28 \ display
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
29 \ '^'
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
30 \ nextgroup=hostconfComment,hostconfKeyword
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
31 \ skipwhite
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
32
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
33 syn keyword hostconfKeyword
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
34 \ contained
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
35 \ order
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
36 \ nextgroup=hostconfLookupOrder
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
37 \ skipwhite
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
38
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
39 let s:orders = ['bind', 'hosts', 'nis']
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
40
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
41 function s:permute_suffixes(list)
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
42 if empty(a:list)
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
43 return []
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
44 elseif len(a:list) == 1
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
45 return a:list[0]
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
46 else
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
47 let i = 0
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
48 let n = len(a:list)
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
49 let sub_permutations = []
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
50 while i < n
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
51 let list_copy = copy(a:list)
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
52 let removed = list_copy[i]
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
53 call remove(list_copy, i)
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
54 call add(sub_permutations, [removed, s:permute_suffixes(list_copy)])
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
55 let i += 1
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
56 endwhile
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
57 return sub_permutations
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
58 endif
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
59 endfunction
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
60
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
61 function s:generate_suffix_groups(list_of_order_of_orders, context, trailing_context)
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
62 for order_of_orders in a:list_of_order_of_orders
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
63 let order = order_of_orders[0]
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
64 let trailing_context = a:trailing_context . toupper(order[0]) . order[1:]
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
65 let nextgroup = 'hostconfLookupOrder' . trailing_context
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
66 let nextgroup_delimiter = nextgroup . 'Delimiter'
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
67 let group = 'hostconfLookupOrder' . a:context
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
68 execute 'syn keyword' group 'contained' order 'nextgroup=' . nextgroup_delimiter 'skipwhite'
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
69 execute 'syn match' nextgroup_delimiter 'contained display "," nextgroup=' . nextgroup 'skipwhite'
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
70 if a:context != ""
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
71 execute 'hi def link' group 'hostconfLookupOrder'
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
72 endif
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
73 execute 'hi def link' nextgroup_delimiter 'hostconfLookupOrderDelimiter'
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
74 let context = trailing_context
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
75 if type(order_of_orders[1]) == type([])
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
76 call s:generate_suffix_groups(order_of_orders[1], context, trailing_context)
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
77 else
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
78 execute 'syn keyword hostconfLookupOrder' . context 'contained' order_of_orders[-1]
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
79 execute 'hi def link hostconfLookupOrder' . context 'hostconfLookupOrder'
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
80 endif
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
81 endfor
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
82 endfunction
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
83
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
84 call s:generate_suffix_groups(s:permute_suffixes(s:orders), "", "")
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
85
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
86 delfunction s:generate_suffix_groups
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
87 delfunction s:permute_suffixes
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
88
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
89 syn keyword hostconfKeyword
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
90 \ contained
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
91 \ trim
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
92 \ nextgroup=hostconfDomain
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
93 \ skipwhite
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
94
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
95 syn match hostconfDomain
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
96 \ contained
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
97 \ '\.[^:;,[:space:]]\+'
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
98 \ nextgroup=hostconfDomainDelimiter
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
99 \ skipwhite
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
100
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
101 syn match hostconfDomainDelimiter
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
102 \ contained
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
103 \ display
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
104 \ '[:;,]'
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
105 \ nextgroup=hostconfDomain
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
106 \ skipwhite
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
107
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
108 syn keyword hostconfKeyword
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
109 \ contained
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
110 \ multi
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
111 \ nospoof
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
112 \ spoofalert
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
113 \ reorder
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
114 \ nextgroup=hostconfBoolean
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
115 \ skipwhite
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
116
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
117 syn keyword hostconfBoolean
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
118 \ contained
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
119 \ on
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
120 \ off
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
121
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
122 syn keyword hostconfKeyword
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
123 \ contained
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
124 \ spoof
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
125 \ nextgroup=hostconfSpoofValue
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
126 \ skipwhite
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
127
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
128 syn keyword hostconfSpoofValue
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
129 \ contained
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
130 \ off
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
131 \ nowarn
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
132 \ warn
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
133
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
134 hi def link hostconfTodo Todo
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
135 hi def link hostconfComment Comment
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
136 hi def link hostconfKeyword Keyword
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
137 hi def link hostconfLookupOrder Identifier
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
138 hi def link hostconfLookupOrderDelimiter Delimiter
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
139 hi def link hostconfDomain String
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
140 hi def link hostconfDomainDelimiter Delimiter
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
141 hi def link hostconfBoolean Boolean
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
142 hi def link hostconfSpoofValue hostconfBoolean
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
143
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
144 let b:current_syntax = "hostconf"
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
145
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
146 let &cpo = s:cpo_save
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
147 unlet s:cpo_save