blob: 8db83f91da7d6f60e04733a8bc8c2378be57c13e [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
Bram Moolenaarfc1421e2006-04-20 22:17:20 +00002" Language: BIND zone files (RFC1035)
3" Maintainer: Julian Mehnle <julian@mehnle.net>
4" URL: http://www.mehnle.net/source/odds+ends/vim/syntax/
5" Last Change: Thu 2006-04-20 12:30:45 UTC
6"
7" Based on an earlier version by Вячеслав Горбанев (Slava Gorbanev), with
8" heavy modifications.
9"
Bram Moolenaar5c736222010-01-06 20:54:52 +010010" $Id: bindzone.vim,v 1.2 2006/04/20 22:06:21 vimboss Exp $
Bram Moolenaar071d4272004-06-13 20:20:40 +000011
12" For version 5.x: Clear all syntax items
13" For version 6.x: Quit when a syntax file was already loaded
14if version < 600
15 syntax clear
16elseif exists("b:current_syntax")
17 finish
18endif
19
20syn case match
21
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000022" Directives
23syn region zoneRRecord start=/^/ end=/$/ contains=zoneOwnerName,zoneSpecial,zoneTTL,zoneClass,zoneRRType,zoneComment,zoneUnknown
Bram Moolenaar071d4272004-06-13 20:20:40 +000024
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000025syn match zoneDirective /^\$ORIGIN\s\+/ nextgroup=zoneOrigin,zoneUnknown
26syn match zoneDirective /^\$TTL\s\+/ nextgroup=zoneNumber,zoneUnknown
27syn match zoneDirective /^\$INCLUDE\s\+/ nextgroup=zoneText,zoneUnknown
28syn match zoneDirective /^\$GENERATE\s/
Bram Moolenaar071d4272004-06-13 20:20:40 +000029
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000030syn match zoneUnknown contained /\S\+/
Bram Moolenaar071d4272004-06-13 20:20:40 +000031
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000032syn match zoneOwnerName contained /^[^[:space:]!"#$%&'()*+,\/:;<=>?@[\]\^`{|}~]\+\(\s\|;\)\@=/ nextgroup=zoneTTL,zoneClass,zoneRRType skipwhite
33syn match zoneOrigin contained /[^[:space:]!"#$%&'()*+,\/:;<=>?@[\]\^`{|}~]\+\(\s\|;\|$\)\@=/
34syn match zoneDomain contained /[^[:space:]!"#$%&'()*+,\/:;<=>?@[\]\^`{|}~]\+\(\s\|;\|$\)\@=/
Bram Moolenaar071d4272004-06-13 20:20:40 +000035
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000036syn match zoneSpecial contained /^[@*.]\s/
37syn match zoneTTL contained /\<\d[0-9HhWwDd]*\>/ nextgroup=zoneClass,zoneRRType skipwhite
38syn keyword zoneClass contained IN CHAOS nextgroup=zoneRRType,zoneTTL skipwhite
39syn keyword zoneRRType contained A AAAA CNAME HINFO MX NS PTR SOA SRV TXT nextgroup=zoneRData skipwhite
40syn match zoneRData contained /[^;]*/ contains=zoneDomain,zoneIPAddr,zoneIP6Addr,zoneText,zoneNumber,zoneParen,zoneUnknown
Bram Moolenaar071d4272004-06-13 20:20:40 +000041
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000042syn match zoneIPAddr contained /\<[0-9]\{1,3}\(\.[0-9]\{1,3}\)\{,3}\>/
Bram Moolenaar071d4272004-06-13 20:20:40 +000043
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000044" Plain IPv6 address IPv6-embedded-IPv4 address
45" 1111:2:3:4:5:6:7:8 1111:2:3:4:5:6:127.0.0.1
46syn match zoneIP6Addr contained /\<\(\x\{1,4}:\)\{6}\(\x\{1,4}:\x\{1,4}\|\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\>/
47" ::[...:]8 ::[...:]127.0.0.1
48syn match zoneIP6Addr contained /\s\@<=::\(\(\x\{1,4}:\)\{,6}\x\{1,4}\|\(\x\{1,4}:\)\{,5}\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\>/
49" 1111::[...:]8 1111::[...:]127.0.0.1
50syn match zoneIP6Addr contained /\<\(\x\{1,4}:\)\{1}:\(\(\x\{1,4}:\)\{,5}\x\{1,4}\|\(\x\{1,4}:\)\{,4}\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\>/
51" 1111:2::[...:]8 1111:2::[...:]127.0.0.1
52syn match zoneIP6Addr contained /\<\(\x\{1,4}:\)\{2}:\(\(\x\{1,4}:\)\{,4}\x\{1,4}\|\(\x\{1,4}:\)\{,3}\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\>/
53" 1111:2:3::[...:]8 1111:2:3::[...:]127.0.0.1
54syn match zoneIP6Addr contained /\<\(\x\{1,4}:\)\{3}:\(\(\x\{1,4}:\)\{,3}\x\{1,4}\|\(\x\{1,4}:\)\{,2}\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\>/
55" 1111:2:3:4::[...:]8 1111:2:3:4::[...:]127.0.0.1
56syn match zoneIP6Addr contained /\<\(\x\{1,4}:\)\{4}:\(\(\x\{1,4}:\)\{,2}\x\{1,4}\|\(\x\{1,4}:\)\{,1}\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\>/
57" 1111:2:3:4:5::[...:]8 1111:2:3:4:5::127.0.0.1
58syn match zoneIP6Addr contained /\<\(\x\{1,4}:\)\{5}:\(\(\x\{1,4}:\)\{,1}\x\{1,4}\|\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\>/
59" 1111:2:3:4:5:6::8 -
60syn match zoneIP6Addr contained /\<\(\x\{1,4}:\)\{6}:\x\{1,4}\>/
61" 1111[:...]:: -
62syn match zoneIP6Addr contained /\<\(\x\{1,4}:\)\{1,7}:\(\s\|;\|$\)\@=/
Bram Moolenaar071d4272004-06-13 20:20:40 +000063
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000064syn match zoneText contained /"\([^"\\]\|\\.\)*"\(\s\|;\|$\)\@=/
65syn match zoneNumber contained /\<[0-9]\+\(\s\|;\|$\)\@=/
66syn match zoneSerial contained /\<[0-9]\{9,10}\(\s\|;\|$\)\@=/
Bram Moolenaar071d4272004-06-13 20:20:40 +000067
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000068syn match zoneErrParen /)/
69syn region zoneParen contained start="(" end=")" contains=zoneSerial,zoneNumber,zoneComment
70syn match zoneComment /;.*/
Bram Moolenaar071d4272004-06-13 20:20:40 +000071
72" Define the default highlighting.
73" For version 5.7 and earlier: only when not done already
74" For version 5.8 and later: only when an item doesn't have highlighting yet
75if version >= 508 || !exists("did_bind_zone_syn_inits")
76 if version < 508
77 let did_bind_zone_syn_inits = 1
78 command -nargs=+ HiLink hi link <args>
79 else
80 command -nargs=+ HiLink hi def link <args>
81 endif
82
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000083 HiLink zoneDirective Macro
84
85 HiLink zoneUnknown Error
86
87 HiLink zoneOrigin Statement
88 HiLink zoneOwnerName Statement
89 HiLink zoneDomain Identifier
90
91 HiLink zoneSpecial Special
92 HiLink zoneTTL Constant
93 HiLink zoneClass Include
94 HiLink zoneRRType Type
95
96 HiLink zoneIPAddr Number
97 HiLink zoneIP6Addr Number
98 HiLink zoneText String
99 HiLink zoneNumber Number
100 HiLink zoneSerial Special
101
102 HiLink zoneErrParen Error
103 HiLink zoneComment Comment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000104
105 delcommand HiLink
106endif
107
108let b:current_syntax = "bindzone"
109
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000110" vim:sts=2 sw=2