blob: 3c23e219fd4d84949295e7698b50b7a8add4208f [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
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$
8
9" For version 5.x: Clear all syntax items
10" For version 6.x: Quit when a syntax file was already loaded
11if version < 600
12 syntax clear
13elseif exists("b:current_syntax")
14 finish
15endif
16
17syn case match
18
19if version >= 600
20 setlocal iskeyword=.,-,48-58,A-Z,a-z,_
21else
22 set iskeyword=.,-,48-58,A-Z,a-z,_
23endif
24
25
26" Master File Format (rfc 1035)
27
28" directives
29syn region zoneRRecord start=+^+ end=+$+ contains=zoneLHSDomain,zoneLHSIP,zoneIllegalDom,zoneWhitespace,zoneComment,zoneParen,zoneSpecial
30syn match zoneDirective /\$ORIGIN\s\+/ nextgroup=zoneDomain,zoneIllegalDom
31syn match zoneDirective /\$TTL\s\+/ nextgroup=zoneTTL
32syn match zoneDirective /\$INCLUDE\s\+/
33syn match zoneDirective /\$GENERATE\s/
34
35syn match zoneWhitespace contained /^\s\+/ nextgroup=zoneTTL,zoneClass,zoneRRType
36syn match zoneError "\s\+$"
37syn match zoneSpecial contained /^[@.]\s\+/ nextgroup=zoneTTL,zoneClass,zoneRRType
38syn match zoneSpecial contained /@$/
39
40" domains and IPs
41syn match zoneLHSDomain contained /^[-0-9A-Za-z.]\+\s\+/ nextgroup=zoneTTL,zoneClass,zoneRRType
42syn match zoneLHSIP contained /^[0-9]\{1,3}\(\.[0-9]\{1,3}\)\{,3}\s\+/ nextgroup=zoneTTL,zoneClass,zoneRRType
43syn match zoneIPaddr contained /\<[0-9]\{1,3}\(\.[0-9]\{1,3}\)\{,3}\>/
44syn match zoneDomain contained /\<[0-9A-Za-z][-0-9A-Za-z.]\+\>/
45
46syn match zoneIllegalDom contained /\S*[^-A-Za-z0-9.[:space:]]\S*\>/
47"syn match zoneIllegalDom contained /[0-9]\S*[-A-Za-z]\S*/
48
49" keywords
50syn keyword zoneClass IN CHAOS nextgroup=zoneRRType
51
52syn match zoneTTL contained /\<[0-9HhWwDd]\+\s\+/ nextgroup=zoneClass,zoneRRType
53syn match zoneRRType contained /\s*\<\(NS\|HINFO\)\s\+/ nextgroup=zoneSpecial,zoneDomain
54syn match zoneRRType contained /\s*\<CNAME\s\+/ nextgroup=zoneDomain,zoneSpecial
55syn match zoneRRType contained /\s*\<SOA\s\+/ nextgroup=zoneDomain,zoneIllegalDom
56syn match zoneRRType contained /\s*\<PTR\s\+/ nextgroup=zoneDomain,zoneIllegalDom
57syn match zoneRRType contained /\s*\<MX\s\+/ nextgroup=zoneMailPrio
58syn match zoneRRType contained /\s*\<A\s\+/ nextgroup=zoneIPaddr,zoneIllegalDom
59
60" FIXME: catchup serial number
61syn match zoneSerial contained /\<[0-9]\{9}\>/
62
63syn match zoneMailPrio contained /\<[0-9]\+\s*/ nextgroup=zoneDomain,zoneIllegalDom
64syn match zoneErrParen /)/
65syn region zoneParen contained start=+(+ end=+)+ contains=zoneSerial,zoneTTL,zoneComment
66syn match zoneComment ";.*"
67
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
71if version >= 508 || !exists("did_bind_zone_syn_inits")
72 if version < 508
73 let did_bind_zone_syn_inits = 1
74 command -nargs=+ HiLink hi link <args>
75 else
76 command -nargs=+ HiLink hi def link <args>
77 endif
78
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
92
93 delcommand HiLink
94endif
95
96let b:current_syntax = "bindzone"
97
98" vim: ts=17