comparison runtime/syntax/bindzone.vim @ 0:76efa0be13f1

Initial revision
author atsuki
date Sat, 10 Nov 2007 15:07:22 +0900
parents
children e170173ecb68
comparison
equal deleted inserted replaced
-1:000000000000 0:76efa0be13f1
1 " Vim syntax file
2 " 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 "
10 " $Id$
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
22 " Directives
23 syn region zoneRRecord start=/^/ end=/$/ contains=zoneOwnerName,zoneSpecial,zoneTTL,zoneClass,zoneRRType,zoneComment,zoneUnknown
24
25 syn match zoneDirective /^\$ORIGIN\s\+/ nextgroup=zoneOrigin,zoneUnknown
26 syn match zoneDirective /^\$TTL\s\+/ nextgroup=zoneNumber,zoneUnknown
27 syn match zoneDirective /^\$INCLUDE\s\+/ nextgroup=zoneText,zoneUnknown
28 syn match zoneDirective /^\$GENERATE\s/
29
30 syn match zoneUnknown contained /\S\+/
31
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\|;\|$\)\@=/
35
36 syn match zoneSpecial contained /^[@*.]\s/
37 syn match zoneTTL contained /\<\d[0-9HhWwDd]*\>/ nextgroup=zoneClass,zoneRRType skipwhite
38 syn keyword zoneClass contained IN CHAOS nextgroup=zoneRRType,zoneTTL skipwhite
39 syn keyword zoneRRType contained A AAAA CNAME HINFO MX NS PTR SOA SRV TXT nextgroup=zoneRData skipwhite
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}\>/
43
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\|;\|$\)\@=/
63
64 syn match zoneText contained /"\([^"\\]\|\\.\)*"\(\s\|;\|$\)\@=/
65 syn match zoneNumber contained /\<[0-9]\+\(\s\|;\|$\)\@=/
66 syn match zoneSerial contained /\<[0-9]\{9,10}\(\s\|;\|$\)\@=/
67
68 syn match zoneErrParen /)/
69 syn region zoneParen contained start="(" end=")" contains=zoneSerial,zoneNumber,zoneComment
70 syn match zoneComment /;.*/
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
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
104
105 delcommand HiLink
106 endif
107
108 let b:current_syntax = "bindzone"
109
110 " vim:sts=2 sw=2