Skip to content

Commit

Permalink
- Added 'syn sync fromstart' so that artifact doesn't appear when re-…
Browse files Browse the repository at this point in the history
…editing a file back into the middle of a file.

- Added CAA syntaxes.
- Tweak for OPENPGPKEY so that highlighting of things inside a pair of parenthesis gets better done.
  • Loading branch information
steve committed Sep 15, 2020
1 parent 5a0676e commit 149283a
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions syntax/bindzone.vim
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ endif

syn case match

syn sync fromstart

" Directives
syn region zoneRRecord start=/\v^/ end=/\v$/ contains=zoneOwnerName,zoneSpecial,zoneComment,zoneUnknown

Expand All @@ -33,6 +35,10 @@ hi def link zoneOrigin Statement
syn match zoneDomain contained /\v([^[:space:]!"#$%&'()*+,\/:;<=>?@[\]\^`{|}~]+|\@)(\s|;|$)@=/
hi def link zoneDomain Underlined

" syn match zoneCAA_QuotedTagValue contained /\v"(([\x21-\x3a])|([\x37-\x7e])){1,255)"(\s|;|$)@=/
syn match zoneCAA_QuotedTagValue contained /\v"(([\x21\x23-\x7e])){1,255}"/
hi def link zoneCAA_QuotedTagValue String

syn match zoneSpecial contained /\v^(\@|\*(\.\S*)?)\s@=/ nextgroup=zoneTTL,zoneClass,zoneRRType skipwhite
hi def link zoneSpecial Special

Expand All @@ -42,6 +48,33 @@ hi def link zoneTTL Constant
syn keyword zoneClass contained IN CHAOS CH HS ANY nextgroup=zoneRRType,zoneTTL skipwhite
hi def link zoneClass Include

syn match zoneCAA_unknown_tag contained
\ /\v<[a-zA-Z0-9]{1,64}>/
\ skipwhite
\ nextgroup=zoneCAA_QuotedTagValue
hi def link zoneCAA_unknown_tag Special

syn match zoneCAA_property_issue contained /issue/ skipwhite
\ nextgroup=zoneCAA_QuotedTagValue
hi def link zoneCAA_property_issue Variable

syn match zoneCAA_property_issuewild contained /issuewild/ skipwhite
\ nextgroup=zoneCAA_QuotedTagValue
hi def link zoneCAA_property_issuewild Variable

syn match zoneCAA_property_iodef contained /iodef/ skipwhite
\ nextgroup=zoneCAA_QuotedTagValue
hi def link zoneCAA_property_iodef Variable

syn match zoneCAA_Number contained /\v\d{1,3}/ skipwhite
\ nextgroup=
\ zoneCAA_property_issue,
\ zoneCAA_property_issuewild,
\ zoneCAA_property_iodef,
\ zoneCAA_unknown_tag
hi def link zoneCAA_Number Constant


let s:dataRegexp = {}
let s:dataRegexp["zoneNumber"] = "/\\v<[0-9]+>/"
let s:dataRegexp["zoneDomain"] = "/\\v[^[:space:]!\"#$%&'()*+,\\/:;<=>?@[\\]\\^`{|}~]+[^[:space:]!\"#$%&'()*+,\\/:;<=>?@[\\]\\^`{|}~]@!/"
Expand Down Expand Up @@ -122,6 +155,8 @@ endfunction
syn keyword zoneRRType contained A nextgroup=zoneIPAddr skipwhite
syn keyword zoneRRType contained AAAA nextgroup=zoneIP6Addr skipwhite
syn keyword zoneRRType contained NS CNAME PTR DNAME nextgroup=zoneDomain skipwhite
syn keyword zoneRRType contained CAA skipwhite
\ nextgroup=zoneCAA_Number
call s:createChain("OPENPGPKEY", ["zoneHex"])
call s:createChain("MX", ["zoneNumber", "zoneDomain"])
call s:createChain("SRV", ["zoneNumber", "zoneNumber", "zoneNumber", "zoneDomain"])
Expand All @@ -139,8 +174,8 @@ syn keyword zoneRRType contained WKS HINFO RP
\ DHCID SMIMEA HIP NINFO RKEY TALINK CDS CDSNKEY CSYNC ZONEMD
\ SVCB HTTPS SPF UINFO UID
\ GID UNSPEC NID L32 L64 LP
\ TKEY TSIG IXFR AXFR
\ URI CAA AVC DOA AMTRELAY TA
\ TKEY TSIG IXFR AXFR
\ URI AVC DOA AMTRELAY TA OPENPGPKEY
\ nextgroup=zoneRData skipwhite
syn match zoneRRType contained /\vTYPE\d+/ nextgroup=zoneUnknownType1 skipwhite
hi def link zoneRRType Type
Expand Down

0 comments on commit 149283a

Please sign in to comment.