Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " 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 |
| 11 | if version < 600 |
| 12 | syntax clear |
| 13 | elseif exists("b:current_syntax") |
| 14 | finish |
| 15 | endif |
| 16 | |
| 17 | syn case match |
| 18 | |
| 19 | if version >= 600 |
| 20 | setlocal iskeyword=.,-,48-58,A-Z,a-z,_ |
| 21 | else |
| 22 | set iskeyword=.,-,48-58,A-Z,a-z,_ |
| 23 | endif |
| 24 | |
| 25 | |
| 26 | " Master File Format (rfc 1035) |
| 27 | |
| 28 | " directives |
| 29 | syn region zoneRRecord start=+^+ end=+$+ contains=zoneLHSDomain,zoneLHSIP,zoneIllegalDom,zoneWhitespace,zoneComment,zoneParen,zoneSpecial |
| 30 | syn match zoneDirective /\$ORIGIN\s\+/ nextgroup=zoneDomain,zoneIllegalDom |
| 31 | syn match zoneDirective /\$TTL\s\+/ nextgroup=zoneTTL |
| 32 | syn match zoneDirective /\$INCLUDE\s\+/ |
| 33 | syn match zoneDirective /\$GENERATE\s/ |
| 34 | |
| 35 | syn match zoneWhitespace contained /^\s\+/ nextgroup=zoneTTL,zoneClass,zoneRRType |
| 36 | syn match zoneError "\s\+$" |
| 37 | syn match zoneSpecial contained /^[@.]\s\+/ nextgroup=zoneTTL,zoneClass,zoneRRType |
| 38 | syn match zoneSpecial contained /@$/ |
| 39 | |
| 40 | " domains and IPs |
| 41 | syn match zoneLHSDomain contained /^[-0-9A-Za-z.]\+\s\+/ nextgroup=zoneTTL,zoneClass,zoneRRType |
| 42 | syn match zoneLHSIP contained /^[0-9]\{1,3}\(\.[0-9]\{1,3}\)\{,3}\s\+/ nextgroup=zoneTTL,zoneClass,zoneRRType |
| 43 | syn match zoneIPaddr contained /\<[0-9]\{1,3}\(\.[0-9]\{1,3}\)\{,3}\>/ |
| 44 | syn match zoneDomain contained /\<[0-9A-Za-z][-0-9A-Za-z.]\+\>/ |
| 45 | |
| 46 | syn 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 |
| 50 | syn keyword zoneClass IN CHAOS nextgroup=zoneRRType |
| 51 | |
| 52 | syn match zoneTTL contained /\<[0-9HhWwDd]\+\s\+/ nextgroup=zoneClass,zoneRRType |
| 53 | syn match zoneRRType contained /\s*\<\(NS\|HINFO\)\s\+/ nextgroup=zoneSpecial,zoneDomain |
| 54 | syn match zoneRRType contained /\s*\<CNAME\s\+/ nextgroup=zoneDomain,zoneSpecial |
| 55 | syn match zoneRRType contained /\s*\<SOA\s\+/ nextgroup=zoneDomain,zoneIllegalDom |
| 56 | syn match zoneRRType contained /\s*\<PTR\s\+/ nextgroup=zoneDomain,zoneIllegalDom |
| 57 | syn match zoneRRType contained /\s*\<MX\s\+/ nextgroup=zoneMailPrio |
| 58 | syn match zoneRRType contained /\s*\<A\s\+/ nextgroup=zoneIPaddr,zoneIllegalDom |
| 59 | |
| 60 | " FIXME: catchup serial number |
| 61 | syn match zoneSerial contained /\<[0-9]\{9}\>/ |
| 62 | |
| 63 | syn match zoneMailPrio contained /\<[0-9]\+\s*/ nextgroup=zoneDomain,zoneIllegalDom |
| 64 | syn match zoneErrParen /)/ |
| 65 | syn region zoneParen contained start=+(+ end=+)+ contains=zoneSerial,zoneTTL,zoneComment |
| 66 | syn 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 |
| 71 | if 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 |
| 94 | endif |
| 95 | |
| 96 | let b:current_syntax = "bindzone" |
| 97 | |
| 98 | " vim: ts=17 |