bindzone.vim (4932B)
1 " Vim syntax file 2 " Language: BIND zone files (RFC 1035) 3 " Maintainer: Julian Mehnle <julian@mehnle.net> 4 " URL: http://www.mehnle.net/source/odds+ends/vim/syntax/ 5 " Last Change: Thu 2011-07-16 20:42:00 UTC 6 " 7 " Based on an earlier version by Вячеслав Горбанев (Slava Gorbanev), with 8 " heavy modifications. 9 " 10 " $Id: bindzone.vim 12 2011-07-16 21:09:57Z julian $ 11 12 " quit when a syntax file was already loaded 13 if exists("b:current_syntax") 14 finish 15 endif 16 17 syn case match 18 19 " Directives 20 syn region zoneRRecord start=/^/ end=/$/ contains=zoneOwnerName,zoneSpecial,zoneTTL,zoneClass,zoneRRType,zoneComment,zoneUnknown 21 22 syn match zoneDirective /^\$ORIGIN\s\+/ nextgroup=zoneOrigin,zoneUnknown 23 syn match zoneDirective /^\$TTL\s\+/ nextgroup=zoneTTL,zoneUnknown 24 syn match zoneDirective /^\$INCLUDE\s\+/ nextgroup=zoneText,zoneUnknown 25 syn match zoneDirective /^\$GENERATE\s/ 26 27 syn match zoneUnknown contained /\S\+/ 28 29 syn match zoneOwnerName contained /^[^[:space:]!"#$%&'()*+,\/:;<=>?@[\]\^`{|}~]\+\(\s\|;\)\@=/ nextgroup=zoneTTL,zoneClass,zoneRRType skipwhite 30 syn match zoneOrigin contained /[^[:space:]!"#$%&'()*+,\/:;<=>?@[\]\^`{|}~]\+\(\s\|;\|$\)\@=/ 31 syn match zoneDomain contained /[^[:space:]!"#$%&'()*+,\/:;<=>?@[\]\^`{|}~]\+\(\s\|;\|$\)\@=/ 32 33 syn match zoneSpecial contained /^[@*.]\s/ 34 syn match zoneTTL contained /\s\@<=\d[0-9WwDdHhMmSs]*\(\s\|$\)\@=/ nextgroup=zoneClass,zoneRRType skipwhite 35 syn keyword zoneClass contained IN CHAOS CH HS HESIOD nextgroup=zoneRRType,zoneTTL skipwhite 36 syn keyword zoneRRType contained A AAAA APL CAA CERT CNAME DNAME DNSKEY DS HINFO LOC MX NAPTR NS NSEC NSEC3 NSEC3PARAM OPENPGPKEY PTR RP RRSIG SMIMEA SOA SPF SRV SSHFP TLSA TXT nextgroup=zoneRData skipwhite 37 syn match zoneRData contained /[^;]*/ contains=zoneDomain,zoneIPAddr,zoneIP6Addr,zoneText,zoneNumber,zoneParen,zoneUnknown 38 39 syn match zoneIPAddr contained /\<[0-9]\{1,3}\(\.[0-9]\{1,3}\)\{,3}\>/ 40 41 " Plain IPv6 address IPv6-embedded-IPv4 address 42 " 1111:2:3:4:5:6:7:8 1111:2:3:4:5:6:127.0.0.1 43 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}\)\>/ 44 " ::[...:]8 ::[...:]127.0.0.1 45 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}\)\>/ 46 " 1111::[...:]8 1111::[...:]127.0.0.1 47 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}\)\>/ 48 " 1111:2::[...:]8 1111:2::[...:]127.0.0.1 49 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}\)\>/ 50 " 1111:2:3::[...:]8 1111:2:3::[...:]127.0.0.1 51 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}\)\>/ 52 " 1111:2:3:4::[...:]8 1111:2:3:4::[...:]127.0.0.1 53 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}\)\>/ 54 " 1111:2:3:4:5::[...:]8 1111:2:3:4:5::127.0.0.1 55 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}\)\>/ 56 " 1111:2:3:4:5:6::8 - 57 syn match zoneIP6Addr contained /\<\(\x\{1,4}:\)\{6}:\x\{1,4}\>/ 58 " 1111[:...]:: - 59 syn match zoneIP6Addr contained /\<\(\x\{1,4}:\)\{1,7}:\(\s\|;\|$\)\@=/ 60 61 syn match zoneText contained /"\([^"\\]\|\\.\)*"\(\s\|;\|$\)\@=/ 62 syn match zoneNumber contained /\<[0-9]\+\(\s\|;\|$\)\@=/ 63 syn match zoneSerial contained /\<[0-9]\{1,10}\(\s\|;\|$\)\@=/ 64 65 syn match zoneErrParen /)/ 66 syn region zoneParen contained start="(" end=")" contains=zoneSerial,zoneTTL,zoneNumber,zoneComment 67 syn match zoneComment /;.*/ 68 69 " Define the default highlighting. 70 " Only when an item doesn't have highlighting yet 71 72 hi def link zoneDirective Macro 73 74 hi def link zoneUnknown Error 75 76 hi def link zoneOrigin Statement 77 hi def link zoneOwnerName Statement 78 hi def link zoneDomain Identifier 79 80 hi def link zoneSpecial Special 81 hi def link zoneTTL Constant 82 hi def link zoneClass Include 83 hi def link zoneRRType Type 84 85 hi def link zoneIPAddr Number 86 hi def link zoneIP6Addr Number 87 hi def link zoneText String 88 hi def link zoneNumber Number 89 hi def link zoneSerial Special 90 91 hi def link zoneErrParen Error 92 hi def link zoneComment Comment 93 94 95 let b:current_syntax = "bindzone" 96 97 " vim:sts=2 sw=2