2 " Language: BIND configuration file
3 " Maintainer: Nick Hibma <nick@van-laarhoven.org>
4 " Last change: 2007-01-30
5 " Filenames: named.conf, rndc.conf
6 " Location: http://www.van-laarhoven.org/vim/syntax/named.vim
8 " Previously maintained by glory hump <rnd@web-drive.ru> and updated by Marcin
11 " This file could do with a lot of improvements, so comments are welcome.
12 " Please submit the named.conf (segment) with any comments.
14 " For version 5.x: Clear all syntax items
15 " For version 6.x: Quit when a syntax file was already loaded
18 elseif exists("b:current_syntax")
25 setlocal iskeyword=.,-,48-58,A-Z,a-z,_
27 set iskeyword=.,-,48-58,A-Z,a-z,_
31 syn sync match namedSync grouphere NONE "^(zone|controls|acl|key)"
37 " BIND configuration file
39 syn match namedComment "//.*"
40 syn match namedComment "#.*"
41 syn region namedComment start="/\*" end="\*/"
42 syn region namedString start=/"/ end=/"/ contained
43 " --- omitted trailing semicolon
44 syn match namedError /[^;{#]$/
46 " --- top-level keywords
48 syn keyword namedInclude include nextgroup=namedString skipwhite
49 syn keyword namedKeyword acl key nextgroup=namedIntIdent skipwhite
50 syn keyword namedKeyword server nextgroup=namedIdentifier skipwhite
51 syn keyword namedKeyword controls nextgroup=namedSection skipwhite
52 syn keyword namedKeyword trusted-keys nextgroup=namedIntSection skipwhite
53 syn keyword namedKeyword logging nextgroup=namedLogSection skipwhite
54 syn keyword namedKeyword options nextgroup=namedOptSection skipwhite
55 syn keyword namedKeyword zone nextgroup=namedZoneString skipwhite
57 " --- Identifier: name of following { ... } Section
58 syn match namedIdentifier contained /\k\+/ nextgroup=namedSection skipwhite
59 " --- IntIdent: name of following IntSection
60 syn match namedIntIdent contained /"\=\k\+"\=/ nextgroup=namedIntSection skipwhite
62 " --- Section: { ... } clause
63 syn region namedSection contained start=+{+ end=+};+ contains=namedSection,namedIntKeyword
65 " --- IntSection: section that does not contain other sections
66 syn region namedIntSection contained start=+{+ end=+}+ contains=namedIntKeyword,namedError
68 " --- IntKeyword: keywords contained within `{ ... }' sections only
69 " + these keywords are contained within `key' and `acl' sections
70 syn keyword namedIntKeyword contained key algorithm
71 syn keyword namedIntKeyword contained secret nextgroup=namedString skipwhite
73 " + these keywords are contained within `server' section only
74 syn keyword namedIntKeyword contained bogus support-ixfr nextgroup=namedBool,namedNotBool skipwhite
75 syn keyword namedIntKeyword contained transfers nextgroup=namedNumber,namedNotNumber skipwhite
76 syn keyword namedIntKeyword contained transfer-format
77 syn keyword namedIntKeyword contained keys nextgroup=namedIntSection skipwhite
79 " + these keywords are contained within `controls' section only
80 syn keyword namedIntKeyword contained inet nextgroup=namedIPaddr,namedIPerror skipwhite
81 syn keyword namedIntKeyword contained unix nextgroup=namedString skipwhite
82 syn keyword namedIntKeyword contained port perm owner group nextgroup=namedNumber,namedNotNumber skipwhite
83 syn keyword namedIntKeyword contained allow nextgroup=namedIntSection skipwhite
85 " + these keywords are contained within `update-policy' section only
86 syn keyword namedIntKeyword contained grant nextgroup=namedString skipwhite
87 syn keyword namedIntKeyword contained name self subdomain wildcard nextgroup=namedString skipwhite
88 syn keyword namedIntKeyword TXT A PTR NS SOA A6 CNAME MX ANY skipwhite
91 syn region namedOptSection contained start=+{+ end=+};+ contains=namedOption,namedCNOption,namedComment,namedParenError
93 syn keyword namedOption contained version directory
94 \ nextgroup=namedString skipwhite
95 syn keyword namedOption contained named-xfer dump-file pid-file
96 \ nextgroup=namedString skipwhite
97 syn keyword namedOption contained mem-statistics-file statistics-file
98 \ nextgroup=namedString skipwhite
99 syn keyword namedOption contained auth-nxdomain deallocate-on-exit
100 \ nextgroup=namedBool,namedNotBool skipwhite
101 syn keyword namedOption contained dialup fake-iquery fetch-glue
102 \ nextgroup=namedBool,namedNotBool skipwhite
103 syn keyword namedOption contained has-old-clients host-statistics
104 \ nextgroup=namedBool,namedNotBool skipwhite
105 syn keyword namedOption contained maintain-ixfr-base multiple-cnames
106 \ nextgroup=namedBool,namedNotBool skipwhite
107 syn keyword namedOption contained notify recursion rfc2308-type1
108 \ nextgroup=namedBool,namedNotBool skipwhite
109 syn keyword namedOption contained use-id-pool treat-cr-as-space
110 \ nextgroup=namedBool,namedNotBool skipwhite
111 syn keyword namedOption contained also-notify forwarders
112 \ nextgroup=namedIPlist skipwhite
113 syn keyword namedOption contained forward check-names
114 syn keyword namedOption contained allow-query allow-transfer allow-recursion
115 \ nextgroup=namedAML skipwhite
116 syn keyword namedOption contained blackhole listen-on
117 \ nextgroup=namedIntSection skipwhite
118 syn keyword namedOption contained lame-ttl max-transfer-time-in
119 \ nextgroup=namedNumber,namedNotNumber skipwhite
120 syn keyword namedOption contained max-ncache-ttl min-roots
121 \ nextgroup=namedNumber,namedNotNumber skipwhite
122 syn keyword namedOption contained serial-queries transfers-in
123 \ nextgroup=namedNumber,namedNotNumber skipwhite
124 syn keyword namedOption contained transfers-out transfers-per-ns
125 syn keyword namedOption contained transfer-format
126 syn keyword namedOption contained transfer-source
127 \ nextgroup=namedIPaddr,namedIPerror skipwhite
128 syn keyword namedOption contained max-ixfr-log-size
129 \ nextgroup=namedNumber,namedNotNumber skipwhite
130 syn keyword namedOption contained coresize datasize files stacksize
131 syn keyword namedOption contained cleaning-interval interface-interval statistics-interval heartbeat-interval
132 \ nextgroup=namedNumber,namedNotNumber skipwhite
133 syn keyword namedOption contained topology sortlist rrset-order
134 \ nextgroup=namedIntSection skipwhite
136 syn match namedOption contained /\<query-source\s\+.*;/he=s+12 contains=namedQSKeywords
137 syn keyword namedQSKeywords contained address port
138 syn match namedCNOption contained /\<check-names\s\+.*;/he=s+11 contains=namedCNKeywords
139 syn keyword namedCNKeywords contained fail warn ignore master slave response
141 " --- logging facilities
142 syn region namedLogSection contained start=+{+ end=+};+ contains=namedLogOption
143 syn keyword namedLogOption contained channel nextgroup=namedIntIdent skipwhite
144 syn keyword namedLogOption contained category nextgroup=namedIntIdent skipwhite
145 syn keyword namedIntKeyword contained syslog null versions size severity
146 syn keyword namedIntKeyword contained file nextgroup=namedString skipwhite
147 syn keyword namedIntKeyword contained print-category print-severity print-time nextgroup=namedBool,namedNotBool skipwhite
150 syn region namedZoneString contained oneline start=+"+ end=+"+ skipwhite
151 \ contains=namedDomain,namedIllegalDom
152 \ nextgroup=namedZoneClass,namedZoneSection
153 syn keyword namedZoneClass contained in hs hesiod chaos
155 \ nextgroup=namedZoneSection skipwhite
157 syn region namedZoneSection contained start=+{+ end=+};+ contains=namedZoneOpt,namedCNOption,namedComment,namedMasters,namedParenError
158 syn keyword namedZoneOpt contained file ixfr-base
159 \ nextgroup=namedString skipwhite
160 syn keyword namedZoneOpt contained notify dialup
161 \ nextgroup=namedBool,namedNotBool skipwhite
162 syn keyword namedZoneOpt contained pubkey forward
163 syn keyword namedZoneOpt contained max-transfer-time-in
164 \ nextgroup=namedNumber,namedNotNumber skipwhite
165 syn keyword namedZoneOpt contained type nextgroup=namedZoneType skipwhite
166 syn keyword namedZoneType contained master slave stub forward hint
168 syn keyword namedZoneOpt contained masters forwarders
169 \ nextgroup=namedIPlist skipwhite
170 syn region namedIPlist contained start=+{+ end=+};+ contains=namedIPaddr,namedIPerror,namedParenError,namedComment
171 syn keyword namedZoneOpt contained allow-update allow-query allow-transfer
172 \ nextgroup=namedAML skipwhite
173 syn keyword namedZoneOpt contained update-policy
174 \ nextgroup=namedIntSection skipwhite
176 " --- boolean parameter
177 syn match namedNotBool contained "[^ ;]\+"
178 syn keyword namedBool contained yes no true false 1 0
180 " --- number parameter
181 syn match namedNotNumber contained "[^ 0-9;]\+"
182 syn match namedNumber contained "\d\+"
184 " --- address match list
185 syn region namedAML contained start=+{+ end=+};+ contains=namedParenError,namedComment,namedString
188 syn match namedIPaddr contained /\<[0-9]\{1,3}\(\.[0-9]\{1,3}\)\{3};/he=e-1
189 syn match namedDomain contained /\<[0-9A-Za-z][-0-9A-Za-z.]\+\>/ nextgroup=namedSpareDot
190 syn match namedDomain contained /"\."/ms=s+1,me=e-1
191 syn match namedSpareDot contained /\./
194 syn match namedIllegalDom contained /"\S*[^-A-Za-z0-9.[:space:]]\S*"/ms=s+1,me=e-1
195 syn match namedIPerror contained /\<\S*[^0-9.[:space:];]\S*/
196 syn match namedEParenError contained +{+
197 syn match namedParenError +}\([^;]\|$\)+
199 " Define the default highlighting.
200 " For version 5.7 and earlier: only when not done already
201 " For version 5.8 and later: only when an item doesn't have highlighting yet
202 if version >= 508 || !exists("did_named_syn_inits")
204 let did_named_syn_inits = 1
205 command -nargs=+ HiLink hi link <args>
207 command -nargs=+ HiLink hi def link <args>
210 HiLink namedComment Comment
211 HiLink namedInclude Include
212 HiLink namedKeyword Keyword
213 HiLink namedIntKeyword Keyword
214 HiLink namedIdentifier Identifier
215 HiLink namedIntIdent Identifier
217 HiLink namedString String
218 HiLink namedBool Type
219 HiLink namedNotBool Error
220 HiLink namedNumber Number
221 HiLink namedNotNumber Error
223 HiLink namedOption namedKeyword
224 HiLink namedLogOption namedKeyword
225 HiLink namedCNOption namedKeyword
226 HiLink namedQSKeywords Type
227 HiLink namedCNKeywords Type
228 HiLink namedLogCategory Type
229 HiLink namedIPaddr Number
230 HiLink namedDomain Identifier
231 HiLink namedZoneOpt namedKeyword
232 HiLink namedZoneType Type
233 HiLink namedParenError Error
234 HiLink namedEParenError Error
235 HiLink namedIllegalDom Error
236 HiLink namedIPerror Error
237 HiLink namedSpareDot Error
238 HiLink namedError Error
243 let &cpo = s:save_cpo
246 let b:current_syntax = "named"