blob: cbb9105d2ff1c7c50e6245bf24913c18e3b80cfa [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>
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +02005" License: This file can be redistributed and/or modified under the same terms
Bram Moolenaarb21e5842006-04-16 18:30:08 +00006" as Vim itself.
Bram Moolenaarc8734422012-06-01 22:38:45 +02007" Last Change: 2012-05-24
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 Moolenaar1aeaf8c2012-05-18 13:46:39 +020017syn match resolvComment /\s*[#;].*$/ contains=@Spell
Bram Moolenaarc8734422012-06-01 22:38:45 +020018syn match resolvOperator /[/:]/ contained
Bram Moolenaar071d4272004-06-13 20:20:40 +000019
20" IP
Bram Moolenaar071d4272004-06-13 20:20:40 +000021syn cluster resolvIPCluster contains=resolvIPError,resolvIPSpecial
Bram Moolenaarc8734422012-06-01 22:38:45 +020022syn match resolvIPError /\%(\d\{4,}\|25[6-9]\|2[6-9]\d\|[3-9]\d\{2}\)[.0-9]*/ contained
Bram Moolenaar071d4272004-06-13 20:20:40 +000023syn 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 Moolenaarc8734422012-06-01 22:38:45 +020028syn match resolvHostname contained /\w\{-}\.[-0-9A-Za-z_.]*/
Bram Moolenaar071d4272004-06-13 20:20:40 +000029
30" Particular
Bram Moolenaarb21e5842006-04-16 18:30:08 +000031syn match resolvIPNameserver contained /\%(\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\s\|$\)\)\+/ contains=@resolvIPCluster
32syn match resolvHostnameSearch contained /\%(\%([-0-9A-Za-z_]\+\.\)*[-0-9A-Za-z_]\+\.\?\%(\s\|$\)\)\+/
33syn 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 +000034
35" Identifiers
Bram Moolenaarb21e5842006-04-16 18:30:08 +000036syn match resolvNameserver /^\s*nameserver\>/ nextgroup=resolvIPNameserver skipwhite
37syn match resolvLwserver /^\s*lwserver\>/ nextgroup=resolvIPNameserver skipwhite
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +020038syn match resolvDomain /^\s*domain\>/ nextgroup=resolvHostname skipwhite
Bram Moolenaarb21e5842006-04-16 18:30:08 +000039syn match resolvSearch /^\s*search\>/ nextgroup=resolvHostnameSearch skipwhite
40syn match resolvSortList /^\s*sortlist\>/ nextgroup=resolvIPNetmaskSortList skipwhite
41syn match resolvOptions /^\s*options\>/ nextgroup=resolvOption skipwhite
Bram Moolenaar071d4272004-06-13 20:20:40 +000042
43" Options
Bram Moolenaarb21e5842006-04-16 18:30:08 +000044" FIXME: The manual page and the source code do not exactly agree on the set
45" of allowed options
46syn match resolvOption /\<\%(debug\|no_tld_query\|rotate\|no-check-names\|inet6\)\>/ contained nextgroup=resolvOption skipwhite
47syn match resolvOption /\<\%(ndots\|timeout\|attempts\):\d\+\>/ contained contains=resolvOperator nextgroup=resolvOption skipwhite
Bram Moolenaar071d4272004-06-13 20:20:40 +000048
49" Additional errors
50syn match resolvError /^search .\{257,}/
Bram Moolenaar071d4272004-06-13 20:20:40 +000051
52if version >= 508 || !exists("did_config_syntax_inits")
53 if version < 508
54 let did_config_syntax_inits = 1
55 command! -nargs=+ HiLink hi link <args>
56 else
57 command! -nargs=+ HiLink hi def link <args>
58 endif
59
60 HiLink resolvIP Number
61 HiLink resolvIPNetmask Number
62 HiLink resolvHostname String
63 HiLink resolvOption String
64
65 HiLink resolvIPNameserver Number
66 HiLink resolvHostnameSearch String
67 HiLink resolvIPNetmaskSortList Number
68
69 HiLink resolvNameServer Identifier
Bram Moolenaarb21e5842006-04-16 18:30:08 +000070 HiLink resolvLwserver Identifier
Bram Moolenaar071d4272004-06-13 20:20:40 +000071 HiLink resolvDomain Identifier
72 HiLink resolvSearch Identifier
73 HiLink resolvSortList Identifier
74 HiLink resolvOptions Identifier
75
76 HiLink resolvComment Comment
77 HiLink resolvOperator Operator
78 HiLink resolvError Error
79 HiLink resolvIPError Error
80 HiLink resolvIPSpecial Special
81
82 delcommand HiLink
83endif
84
85let b:current_syntax = "resolv"
86
87" vim: ts=8 ft=vim