blob: 1c0f8467d18f07e4c7fcf25ae9304cc102aef592 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
Bram Moolenaarb21e5842006-04-16 18:30:08 +00002" Language: resolver configuration file
Bram Moolenaardb7207e2012-02-22 17:30:19 +01003" Maintainer: David Necas (Yeti) <yeti@physics.muni.cz>
Bram Moolenaarb21e5842006-04-16 18:30:08 +00004" Original Maintaner: Radu Dineiu <littledragon@altern.org>
5" License: This file can be redistribued and/or modified under the same terms
6" as Vim itself.
Bram Moolenaardb7207e2012-02-22 17:30:19 +01007" Last Change: 2012-02-21
Bram Moolenaar071d4272004-06-13 20:20:40 +00008
9if version < 600
10 syntax clear
11elseif exists("b:current_syntax")
12 finish
13endif
14
15" Errors, comments and operators
16syn match resolvError /./
Bram Moolenaarb21e5842006-04-16 18:30:08 +000017syn match resolvComment /\s*[#;].*$/
Bram Moolenaar071d4272004-06-13 20:20:40 +000018syn match resolvOperator /[\/:]/ contained
19
20" IP
Bram Moolenaar071d4272004-06-13 20:20:40 +000021syn cluster resolvIPCluster contains=resolvIPError,resolvIPSpecial
22syn match resolvIPError /\%(\d\{4,}\|25[6-9]\|2[6-9]\d\|[3-9]\d\{2}\)[\.0-9]*/ contained
23syn match resolvIPSpecial /\%(127\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}\)/ contained
24
25" General
26syn match resolvIP contained /\%(\d\{1,4}\.\)\{3}\d\{1,4}/ contains=@resolvIPCluster
27syn match resolvIPNetmask contained /\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\%(\%(\d\{1,4}\.\)\{,3}\d\{1,4}\)\)\?/ contains=resolvOperator,@resolvIPCluster
Bram Moolenaardb7207e2012-02-22 17:30:19 +010028syn match resolvHostname contained /\w\{-}\.[-0-9A-Za-z_.]*/
29syn match resolvDomainname contained /[-0-9A-Za-z_.]\+/
Bram Moolenaar071d4272004-06-13 20:20:40 +000030
31" Particular
Bram Moolenaarb21e5842006-04-16 18:30:08 +000032syn match resolvIPNameserver contained /\%(\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\s\|$\)\)\+/ contains=@resolvIPCluster
33syn match resolvHostnameSearch contained /\%(\%([-0-9A-Za-z_]\+\.\)*[-0-9A-Za-z_]\+\.\?\%(\s\|$\)\)\+/
34syn match resolvIPNetmaskSortList contained /\%(\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\%(\%(\d\{1,4}\.\)\{,3}\d\{1,4}\)\)\?\%(\s\|$\)\)\+/ contains=resolvOperator,@resolvIPCluster
Bram Moolenaar071d4272004-06-13 20:20:40 +000035
36" Identifiers
Bram Moolenaarb21e5842006-04-16 18:30:08 +000037syn match resolvNameserver /^\s*nameserver\>/ nextgroup=resolvIPNameserver skipwhite
38syn match resolvLwserver /^\s*lwserver\>/ nextgroup=resolvIPNameserver skipwhite
Bram Moolenaardb7207e2012-02-22 17:30:19 +010039syn match resolvDomain /^\s*domain\>/ nextgroup=resolvDomainname skipwhite
Bram Moolenaarb21e5842006-04-16 18:30:08 +000040syn match resolvSearch /^\s*search\>/ nextgroup=resolvHostnameSearch skipwhite
41syn match resolvSortList /^\s*sortlist\>/ nextgroup=resolvIPNetmaskSortList skipwhite
42syn match resolvOptions /^\s*options\>/ nextgroup=resolvOption skipwhite
Bram Moolenaar071d4272004-06-13 20:20:40 +000043
44" Options
Bram Moolenaarb21e5842006-04-16 18:30:08 +000045" FIXME: The manual page and the source code do not exactly agree on the set
46" of allowed options
47syn match resolvOption /\<\%(debug\|no_tld_query\|rotate\|no-check-names\|inet6\)\>/ contained nextgroup=resolvOption skipwhite
48syn match resolvOption /\<\%(ndots\|timeout\|attempts\):\d\+\>/ contained contains=resolvOperator nextgroup=resolvOption skipwhite
Bram Moolenaar071d4272004-06-13 20:20:40 +000049
50" Additional errors
51syn match resolvError /^search .\{257,}/
Bram Moolenaar071d4272004-06-13 20:20:40 +000052
53if version >= 508 || !exists("did_config_syntax_inits")
54 if version < 508
55 let did_config_syntax_inits = 1
56 command! -nargs=+ HiLink hi link <args>
57 else
58 command! -nargs=+ HiLink hi def link <args>
59 endif
60
61 HiLink resolvIP Number
62 HiLink resolvIPNetmask Number
63 HiLink resolvHostname String
Bram Moolenaardb7207e2012-02-22 17:30:19 +010064 HiLink resolvDomainname String
Bram Moolenaar071d4272004-06-13 20:20:40 +000065 HiLink resolvOption String
66
67 HiLink resolvIPNameserver Number
68 HiLink resolvHostnameSearch String
69 HiLink resolvIPNetmaskSortList Number
70
71 HiLink resolvNameServer Identifier
Bram Moolenaarb21e5842006-04-16 18:30:08 +000072 HiLink resolvLwserver Identifier
Bram Moolenaar071d4272004-06-13 20:20:40 +000073 HiLink resolvDomain Identifier
74 HiLink resolvSearch Identifier
75 HiLink resolvSortList Identifier
76 HiLink resolvOptions Identifier
77
78 HiLink resolvComment Comment
79 HiLink resolvOperator Operator
80 HiLink resolvError Error
81 HiLink resolvIPError Error
82 HiLink resolvIPSpecial Special
83
84 delcommand HiLink
85endif
86
87let b:current_syntax = "resolv"
88
89" vim: ts=8 ft=vim