Skip to content

Commit b966dec

Browse files
author
steve
committed
Zone name and view name can be quoted.
Also add the elusive 'key' support into the namedA_AML for final puzzle piece of the complex recursive address_match_list.
1 parent 893996d commit b966dec

File tree

1 file changed

+33
-7
lines changed

1 file changed

+33
-7
lines changed

syntax/bind-named.vim

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
" only line position of statements of those referenced by
110110
" that 'nextgroup'.
111111
"
112-
" NOTE: DON'T put inline comment on continuation lines for `syntax ...`.
112+
" NOTE: DON'T put Vim inline comment on continuation lines for `syntax ...`.
113113
" It hurts, badly.
114114
"
115115
" quit when a syntax file was already loaded
@@ -865,12 +865,24 @@ syn match namedHexSecretValue contained /\<'[0-9a-fA-F]\+'\>/ skipwhite
865865
syn match namedHexSecretValue contained /\<"[0-9a-fA-F]\+"\>/ skipwhite
866866

867867
hi link namedViewName namedHL_Identifier
868-
" syn match namedViewName contained /[a-zA-Z0-9_\-\.+~@$%\^&*()=\[\]\\|:<>`?]\{1,64}/ skipwhite
869-
syn match namedViewName contained /[a-zA-Z0-9\-_\.]\{1,64}/ skipwhite
868+
syn match namedViewName contained /\<[a-zA-Z0-9_\.\-]\{1,63}\>/
869+
\ skipwhite skipnl skipempty
870+
syn region namedViewName start=/"/hs=s+1 skip=/\\"/ end=/"/he=e-1 contained
871+
\ skipwhite skipnl skipempty
872+
syn region namedViewName start=/'/hs=s+1 skip=/\\'/ end=/'/he=e-1 contained
873+
\ skipwhite skipnl skipempty
874+
870875

871876
hi link named_E_ViewName_SC namedHL_Identifier
872877
syn match named_E_ViewName_SC contained /[a-zA-Z0-9\-_\.]\{1,63}/ skipwhite
873878
\ nextgroup=namedSemicolon
879+
\ skipwhite skipnl skipempty
880+
syn region named_E_ViewName_SC start=/"/hs=s+1 skip=/\\"/ end=/"/he=e-1 contained
881+
\ nextgroup=namedSemicolon
882+
\ skipwhite skipnl skipempty
883+
syn region named_E_ViewName_SC start=/'/hs=s+1 skip=/\\'/ end=/'/he=e-1 contained
884+
\ nextgroup=namedSemicolon
885+
\ skipwhite skipnl skipempty
874886

875887
hi link namedZoneName namedHL_Identifier
876888
syn match namedZoneName contained /[a-zA-Z0-9]\{1,64}/ skipwhite
@@ -994,6 +1006,9 @@ syn match named_DefaultUnlimited_SC contained skipwhite /\cdefault/
9941006
" };
9951007
"
9961008
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1009+
hi link namedA_Key namedHL_Option
1010+
syn keyword namedA_Key contained key skipwhite skipnl skipempty
1011+
\ nextgroup=namedKeyName_SC
9971012

9981013
hi link namedA_AML_Nested_Semicolon namedHL_Normal
9991014
syn match namedA_AML_Nested_Semicolon contained /;/ skipwhite skipempty
@@ -1024,6 +1039,7 @@ syn match namedA_AML_Nested_Not_Operator contained /!/ skipwhite skipempty
10241039
\ namedA_IP6Addr_SC,
10251040
\ namedA_IP6AddrPrefix_SC,
10261041
\ namedA_Bind_Builtins,
1042+
\ namedA_Key,
10271043
\ namedA_ACL_Name,
10281044
\ namedE_UnexpectedSemicolon,
10291045
\ namedE_MissingLParen,
@@ -1041,6 +1057,7 @@ syn region namedA_AML_Recursive contained start=+{+ end=+}+ keepend extend
10411057
\ namedA_IP6Addr_SC,
10421058
\ namedA_IP6AddrPrefix_SC,
10431059
\ namedA_Bind_Builtins,
1060+
\ namedA_Key,
10441061
\ namedA_ACL_Name,
10451062
\ namedA_AML_Nested_Semicolon,
10461063
\ namedA_AML_Nested_Not_Operator
@@ -1061,6 +1078,7 @@ syn region namedA_AML contained start=+{+ end=+}+
10611078
\ namedA_IP6Addr_SC,
10621079
\ namedA_IP6AddrPrefix_SC,
10631080
\ namedA_Bind_Builtins,
1081+
\ namedA_Key,
10641082
\ namedA_ACL_Name,
10651083
\ namedA_AML_Nested_Semicolon,
10661084
\ namedA_AML_Nested_Not_Operator
@@ -5973,10 +5991,15 @@ syn region namedStmt_ViewSection contained start=+{+ end=+}+
59735991
\ namedOVZ_ZoneStat,
59745992
\ namedParenError
59755993

5994+
" charset_view_name_base = alphanums + '_-.+~@$%^&*()=[]\\|:<>`?' # no semicolon nor curly braces allowed
59765995
hi link namedStmt_ViewNameIdentifier namedHL_Identifier
5977-
syn match namedStmt_ViewNameIdentifier contained /\i\+/
5996+
syn match namedStmt_ViewNameIdentifier contained /\S\{1,63}/
5997+
\ contains=namedViewName
59785998
\ skipwhite skipnl skipempty
5979-
\ nextgroup=namedStmt_ViewSection
5999+
\ nextgroup=
6000+
\ namedStmt_ViewSection,
6001+
\ namedInclude,
6002+
\ namedComment
59806003

59816004
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
59826005
" zone <namedStmt_ZoneNameIdentifier> { ... };
@@ -6043,7 +6066,7 @@ syn match namedStmtZoneClass contained /\<\c\%(CHAOS\)\|\%(HESIOD\)\|\%(IN\)\|\%
60436066
\ namedComment
60446067

60456068
hi link namedStmt_ZoneNameIdentifier namedHL_Identifier
6046-
syn match namedStmt_ZoneNameIdentifier contained /\S\+/
6069+
syn match namedStmt_ZoneNameIdentifier contained /\S\{1,63}/
60476070
\ skipwhite skipempty skipnl
60486071
\ contains=named_QuotedDomain
60496072
\ nextgroup=
@@ -6141,7 +6164,10 @@ syn match namedStmtKeyword /\_^\s*\<trusted-keys\>/
61416164
" view <namedStmt_ViewNameIdentifier> { ... };
61426165
syn match namedStmtKeyword /\_^\s*\<view\>/
61436166
\ skipwhite skipnl skipempty
6144-
\ nextgroup=namedStmt_ViewNameIdentifier
6167+
\ nextgroup=
6168+
\ namedStmt_ViewNameIdentifier,
6169+
\ namedInclude,
6170+
\ namedComment
61456171

61466172
" TODO: namedStmtError, how to get namedHL_Error to appear
61476173
" zone <namedStmt_ZoneNameIdentifier> { ... };

0 commit comments

Comments
 (0)