2 " Language: BIND 8.x zone files (RFC1035)
3 " Maintainer: glory hump <rnd@web-drive.ru>
4 " Last change: Thu Apr 26 02:16:18 SAMST 2001
5 " Filenames: /var/named/*
6 " URL: http://rnd.web-drive.ru/vim/syntax/bindzone.vim
7 " $Id: bindzone.vim,v 1.1.1.1 2001/06/07 21:35:10 corinna Exp $
9 " For version 5.x: Clear all syntax items
10 " For version 6.x: Quit when a syntax file was already loaded
13 elseif exists("b:current_syntax")
20 setlocal iskeyword=.,-,48-58,A-Z,a-z,_
22 set iskeyword=.,-,48-58,A-Z,a-z,_
26 " Master File Format (rfc 1035)
29 syn region zoneRRecord start=+^+ end=+$+ contains=zoneLHSDomain,zoneLHSIP,zoneIllegalDom,zoneWhitespace,zoneComment,zoneParen,zoneSpecial
30 syn match zoneDirective /\$ORIGIN\s\+/ nextgroup=zoneDomain,zoneIllegalDom
31 syn match zoneDirective /\$TTL\s\+/ nextgroup=zoneTTL
32 syn match zoneDirective /\$INCLUDE\s\+/
33 syn match zoneDirective /\$GENERATE\s/
35 syn match zoneWhitespace contained /^\s\+/ nextgroup=zoneTTL,zoneClass,zoneRRType
36 syn match zoneError "\s\+$"
37 syn match zoneSpecial contained /^[@.]\s\+/ nextgroup=zoneTTL,zoneClass,zoneRRType
38 syn match zoneSpecial contained /@$/
41 syn match zoneLHSDomain contained /^[-0-9A-Za-z.]\+\s\+/ nextgroup=zoneTTL,zoneClass,zoneRRType
42 syn match zoneLHSIP contained /^[0-9]\{1,3}\(\.[0-9]\{1,3}\)\{,3}\s\+/ nextgroup=zoneTTL,zoneClass,zoneRRType
43 syn match zoneIPaddr contained /\<[0-9]\{1,3}\(\.[0-9]\{1,3}\)\{,3}\>/
44 syn match zoneDomain contained /\<[0-9A-Za-z][-0-9A-Za-z.]\+\>/
46 syn match zoneIllegalDom contained /\S*[^-A-Za-z0-9.[:space:]]\S*\>/
47 "syn match zoneIllegalDom contained /[0-9]\S*[-A-Za-z]\S*/
50 syn keyword zoneClass IN CHAOS nextgroup=zoneRRType
52 syn match zoneTTL contained /\<[0-9HhWwDd]\+\s\+/ nextgroup=zoneClass,zoneRRType
53 syn match zoneRRType contained /\s*\<\(NS\|HINFO\)\s\+/ nextgroup=zoneSpecial,zoneDomain
54 syn match zoneRRType contained /\s*\<CNAME\s\+/ nextgroup=zoneDomain,zoneSpecial
55 syn match zoneRRType contained /\s*\<SOA\s\+/ nextgroup=zoneDomain,zoneIllegalDom
56 syn match zoneRRType contained /\s*\<PTR\s\+/ nextgroup=zoneDomain,zoneIllegalDom
57 syn match zoneRRType contained /\s*\<MX\s\+/ nextgroup=zoneMailPrio
58 syn match zoneRRType contained /\s*\<A\s\+/ nextgroup=zoneIPaddr,zoneIllegalDom
60 " FIXME: catchup serial number
61 syn match zoneSerial contained /\<[0-9]\{9}\>/
63 syn match zoneMailPrio contained /\<[0-9]\+\s*/ nextgroup=zoneDomain,zoneIllegalDom
64 syn match zoneErrParen /)/
65 syn region zoneParen contained start=+(+ end=+)+ contains=zoneSerial,zoneTTL,zoneComment
66 syn match zoneComment ";.*"
68 " Define the default highlighting.
69 " For version 5.7 and earlier: only when not done already
70 " For version 5.8 and later: only when an item doesn't have highlighting yet
71 if version >= 508 || !exists("did_bind_zone_syn_inits")
73 let did_bind_zone_syn_inits = 1
74 command -nargs=+ HiLink hi link <args>
76 command -nargs=+ HiLink hi def link <args>
79 HiLink zoneComment Comment
80 HiLink zoneDirective Macro
81 HiLink zoneLHSDomain Statement
82 HiLink zoneLHSIP Statement
83 HiLink zoneClass Include
84 HiLink zoneSpecial Special
85 HiLink zoneRRType Type
86 HiLink zoneError Error
87 HiLink zoneErrParen Error
88 HiLink zoneIllegalDom Error
89 HiLink zoneSerial Todo
90 HiLink zoneIPaddr Number
91 HiLink zoneDomain Identifier
96 let b:current_syntax = "bindzone"