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