ports/editors/vim/patches/patch-runtime_syntax_bindzone_vim

116 lines
5 KiB
Text
Raw Normal View History

2023-08-16 22:26:55 +00:00
https://github.com/vim/vim/pull/7351
https://github.com/sebastianw/vim-bindzone/blob/master/syntax/bindzone.vim
Index: runtime/syntax/bindzone.vim
--- runtime/syntax/bindzone.vim.orig
+++ runtime/syntax/bindzone.vim
@@ -11,13 +11,16 @@
-" quit when a syntax file was already loaded
-if exists("b:current_syntax")
+" For version 5.x: Clear all syntax items
+" For version 6.x: Quit when a syntax file was already loaded
+if version < 600
+ syntax clear
+elseif exists("b:current_syntax")
finish
endif
syn case match
" Directives
-syn region zoneRRecord start=/^/ end=/$/ contains=zoneOwnerName,zoneSpecial,zoneTTL,zoneClass,zoneRRType,zoneComment,zoneUnknown
+syn region zoneRRecord start=/^/ end=/$/ contains=zoneOwnerName,zoneSpecial,zoneTTL,zoneClass,zoneRRType,zoneRRHashType,zoneComment,zoneUnknown
syn match zoneDirective /^\$ORIGIN\s\+/ nextgroup=zoneOrigin,zoneUnknown
syn match zoneDirective /^\$TTL\s\+/ nextgroup=zoneTTL,zoneUnknown
@@ -26,15 +29,19 @@ syn match zoneDirective /^\$GENERATE\s/
syn match zoneUnknown contained /\S\+/
-syn match zoneOwnerName contained /^[^[:space:]!"#$%&'()*+,\/:;<=>?@[\]\^`{|}~]\+\(\s\|;\)\@=/ nextgroup=zoneTTL,zoneClass,zoneRRType skipwhite
+syn match zoneOwnerName contained /^[^[:space:]!"#$%&'()*+,\/:;<=>?@[\]\^`{|}~]\+\(\s\|;\)\@=/ nextgroup=zoneTTL,zoneClass,zoneRRType,zoneRRHashType skipwhite
syn match zoneOrigin contained /[^[:space:]!"#$%&'()*+,\/:;<=>?@[\]\^`{|}~]\+\(\s\|;\|$\)\@=/
syn match zoneDomain contained /[^[:space:]!"#$%&'()*+,\/:;<=>?@[\]\^`{|}~]\+\(\s\|;\|$\)\@=/
syn match zoneSpecial contained /^[@*.]\s/
-syn match zoneTTL contained /\s\@<=\d[0-9WwDdHhMmSs]*\(\s\|$\)\@=/ nextgroup=zoneClass,zoneRRType skipwhite
-syn keyword zoneClass contained IN CHAOS CH HS HESIOD nextgroup=zoneRRType,zoneTTL skipwhite
-syn keyword zoneRRType contained A AAAA CERT CNAME DNAME DNSKEY DS HINFO LOC MX NAPTR NS NSEC NSEC3 NSEC3PARAM PTR RP RRSIG SSHFP SOA SPF SRV TLSA TXT nextgroup=zoneRData skipwhite
+syn match zoneOwnerName contained /^\*\.[^[:space:]!"#$%&'()*+,\/:;<=>?@[\]\^`{|}~]\+\(\s\|;\)\@=/ nextgroup=zoneTTL,zoneClass,zoneRRType,zoneRRHashType skipwhite
+syn match zoneTTL contained /\s\@<=\d[0-9WwDdHhMmSs]*\(\s\|$\)\@=/ nextgroup=zoneClass,zoneRRType,zoneRRHashType skipwhite
+syn keyword zoneClass contained IN CHAOS nextgroup=zoneRRType,zoneRRHashType,zoneTTL skipwhite
+syn keyword zoneRRType contained A AAAA A6 CAA CERT CNAME DNAME HINFO LOC MX NAPTR NS NSEC NSEC3 NSEC3PARAM PTR RRSIG SOA SPF SRV TXT nextgroup=zoneRData skipwhite
+syn keyword zoneRRHashType contained CERT DNSKEY DS IPSECKEY SSHFP TLSA nextgroup=zoneRHashData skipwhite
syn match zoneRData contained /[^;]*/ contains=zoneDomain,zoneIPAddr,zoneIP6Addr,zoneText,zoneNumber,zoneParen,zoneUnknown
+syn match zoneRHashData contained /[^;]*/ contains=zoneHash,zoneUnknown
+syn match zoneHash contained /\S\+/
syn match zoneIPAddr contained /\<[0-9]\{1,3}\(\.[0-9]\{1,3}\)\{,3}\>/
@@ -67,30 +74,42 @@ syn region zoneParen contained start="(" en
syn match zoneComment /;.*/
" Define the default highlighting.
-" Only when an item doesn't have highlighting yet
+" For version 5.7 and earlier: only when not done already
+" For version 5.8 and later: only when an item doesn't have highlighting yet
+if version >= 508 || !exists("did_bind_zone_syn_inits")
+ if version < 508
+ let did_bind_zone_syn_inits = 1
+ command -nargs=+ HiLink hi link <args>
+ else
+ command -nargs=+ HiLink hi def link <args>
+ endif
-hi def link zoneDirective Macro
+ HiLink zoneDirective Macro
+
+ HiLink zoneUnknown Error
+
+ HiLink zoneOrigin Statement
+ HiLink zoneOwnerName Statement
+ HiLink zoneDomain Identifier
+
+ HiLink zoneSpecial Special
+ HiLink zoneTTL Constant
+ HiLink zoneClass Include
+ HiLink zoneHash String
+ HiLink zoneRRType Type
+ HiLink zoneRRHashType Type
+
+ HiLink zoneIPAddr Number
+ HiLink zoneIP6Addr Number
+ HiLink zoneText String
+ HiLink zoneNumber Number
+ HiLink zoneSerial Special
+
+ HiLink zoneErrParen Error
+ HiLink zoneComment Comment
-hi def link zoneUnknown Error
-
-hi def link zoneOrigin Statement
-hi def link zoneOwnerName Statement
-hi def link zoneDomain Identifier
-
-hi def link zoneSpecial Special
-hi def link zoneTTL Constant
-hi def link zoneClass Include
-hi def link zoneRRType Type
-
-hi def link zoneIPAddr Number
-hi def link zoneIP6Addr Number
-hi def link zoneText String
-hi def link zoneNumber Number
-hi def link zoneSerial Special
-
-hi def link zoneErrParen Error
-hi def link zoneComment Comment
-
+ delcommand HiLink
+endif
let b:current_syntax = "bindzone"