7
|
1 " Vim syntax file
|
2965
|
2 " Language: BIND zone files (RFC 1035)
|
838
|
3 " Maintainer: Julian Mehnle <julian@mehnle.net>
|
|
4 " URL: http://www.mehnle.net/source/odds+ends/vim/syntax/
|
2965
|
5 " Last Change: Thu 2011-07-16 20:42:00 UTC
|
838
|
6 "
|
|
7 " Based on an earlier version by Вячеслав Горбанев (Slava Gorbanev), with
|
|
8 " heavy modifications.
|
|
9 "
|
2965
|
10 " $Id: bindzone.vim 12 2011-07-16 21:09:57Z julian $
|
7
|
11
|
|
12 " For version 5.x: Clear all syntax items
|
|
13 " For version 6.x: Quit when a syntax file was already loaded
|
|
14 if version < 600
|
|
15 syntax clear
|
|
16 elseif exists("b:current_syntax")
|
|
17 finish
|
|
18 endif
|
|
19
|
|
20 syn case match
|
|
21
|
838
|
22 " Directives
|
|
23 syn region zoneRRecord start=/^/ end=/$/ contains=zoneOwnerName,zoneSpecial,zoneTTL,zoneClass,zoneRRType,zoneComment,zoneUnknown
|
7
|
24
|
838
|
25 syn match zoneDirective /^\$ORIGIN\s\+/ nextgroup=zoneOrigin,zoneUnknown
|
2965
|
26 syn match zoneDirective /^\$TTL\s\+/ nextgroup=zoneTTL,zoneUnknown
|
838
|
27 syn match zoneDirective /^\$INCLUDE\s\+/ nextgroup=zoneText,zoneUnknown
|
|
28 syn match zoneDirective /^\$GENERATE\s/
|
7
|
29
|
838
|
30 syn match zoneUnknown contained /\S\+/
|
7
|
31
|
838
|
32 syn match zoneOwnerName contained /^[^[:space:]!"#$%&'()*+,\/:;<=>?@[\]\^`{|}~]\+\(\s\|;\)\@=/ nextgroup=zoneTTL,zoneClass,zoneRRType skipwhite
|
|
33 syn match zoneOrigin contained /[^[:space:]!"#$%&'()*+,\/:;<=>?@[\]\^`{|}~]\+\(\s\|;\|$\)\@=/
|
|
34 syn match zoneDomain contained /[^[:space:]!"#$%&'()*+,\/:;<=>?@[\]\^`{|}~]\+\(\s\|;\|$\)\@=/
|
7
|
35
|
838
|
36 syn match zoneSpecial contained /^[@*.]\s/
|
2965
|
37 syn match zoneTTL contained /\s\@<=\d[0-9WwDdHhMmSs]*\(\s\|$\)\@=/ nextgroup=zoneClass,zoneRRType skipwhite
|
|
38 syn keyword zoneClass contained IN CHAOS nextgroup=zoneRRType,zoneTTL skipwhite
|
|
39 syn keyword zoneRRType contained A AAAA CNAME DNAME HINFO MX NS PTR SOA SRV TXT SPF nextgroup=zoneRData skipwhite
|
838
|
40 syn match zoneRData contained /[^;]*/ contains=zoneDomain,zoneIPAddr,zoneIP6Addr,zoneText,zoneNumber,zoneParen,zoneUnknown
|
|
41
|
|
42 syn match zoneIPAddr contained /\<[0-9]\{1,3}\(\.[0-9]\{1,3}\)\{,3}\>/
|
7
|
43
|
838
|
44 " 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
|
|
46 syn 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
|
|
48 syn 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
|
|
50 syn 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
|
|
52 syn 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
|
|
54 syn 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
|
|
56 syn 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
|
|
58 syn 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 -
|
|
60 syn match zoneIP6Addr contained /\<\(\x\{1,4}:\)\{6}:\x\{1,4}\>/
|
|
61 " 1111[:...]:: -
|
|
62 syn match zoneIP6Addr contained /\<\(\x\{1,4}:\)\{1,7}:\(\s\|;\|$\)\@=/
|
7
|
63
|
838
|
64 syn match zoneText contained /"\([^"\\]\|\\.\)*"\(\s\|;\|$\)\@=/
|
|
65 syn match zoneNumber contained /\<[0-9]\+\(\s\|;\|$\)\@=/
|
|
66 syn match zoneSerial contained /\<[0-9]\{9,10}\(\s\|;\|$\)\@=/
|
7
|
67
|
838
|
68 syn match zoneErrParen /)/
|
2965
|
69 syn region zoneParen contained start="(" end=")" contains=zoneSerial,zoneTTL,zoneNumber,zoneComment
|
838
|
70 syn match zoneComment /;.*/
|
7
|
71
|
|
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
|
|
75 if 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
|
838
|
83 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
|
7
|
104
|
|
105 delcommand HiLink
|
|
106 endif
|
|
107
|
|
108 let b:current_syntax = "bindzone"
|
|
109
|
838
|
110 " vim:sts=2 sw=2
|