Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: resolver configuration file |
| 3 | " Maintaner: Radu Dineiu <littledragon@altern.org> |
| 4 | " URL: http://ld.yi.org/vim/resolv.vim |
| 5 | " ChangeLog: http://ld.yi.org/vim/resolv.ChangeLog |
| 6 | " Last Change: 2003 May 11 |
| 7 | " Version: 0.1 |
| 8 | |
| 9 | if version < 600 |
| 10 | syntax clear |
| 11 | elseif exists("b:current_syntax") |
| 12 | finish |
| 13 | endif |
| 14 | |
| 15 | " Errors, comments and operators |
| 16 | syn match resolvError /./ |
| 17 | syn match resolvNull /^\s*$/ |
| 18 | syn match resolvComment /^\s*#.*$/ |
| 19 | syn match resolvOperator /[\/:]/ contained |
| 20 | |
| 21 | " IP |
| 22 | |
| 23 | syn cluster resolvIPCluster contains=resolvIPError,resolvIPSpecial |
| 24 | syn match resolvIPError /\%(\d\{4,}\|25[6-9]\|2[6-9]\d\|[3-9]\d\{2}\)[\.0-9]*/ contained |
| 25 | syn match resolvIPSpecial /\%(127\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}\)/ contained |
| 26 | |
| 27 | " General |
| 28 | syn match resolvIP contained /\%(\d\{1,4}\.\)\{3}\d\{1,4}/ contains=@resolvIPCluster |
| 29 | syn match resolvIPNetmask contained /\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\%(\%(\d\{1,4}\.\)\{,3}\d\{1,4}\)\)\?/ contains=resolvOperator,@resolvIPCluster |
| 30 | syn match resolvHostname contained /\w\{-}\.[-0-9A-Za-z_\.]*/ |
| 31 | |
| 32 | " Particular |
| 33 | syn match resolvIPNameserver contained /\%(\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\s\|$\)\)\{1,3}/ contains=@resolvIPCluster |
| 34 | syn match resolvHostnameSearch contained /\%(\w\{-}\.[-0-9A-Za-z_\.]\{-}\%(\s\|$\)\)\{1,6}/ |
| 35 | syn match resolvIPNetmaskSortList contained /\%(\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\%(\%(\d\{1,4}\.\)\{,3}\d\{1,4}\)\)\?\%(\s\|$\)\)\{1,10}/ contains=resolvOperator,@resolvIPCluster |
| 36 | |
| 37 | " Identifiers |
| 38 | syn match resolvNameserver /^nameserver / nextgroup=resolvIPNameserver |
| 39 | syn match resolvDomain /^domain / nextgroup=resolvHostname |
| 40 | syn match resolvSearch /^search / nextgroup=resolvHostnameSearch |
| 41 | syn match resolvSortList /^sortlist / nextgroup=resolvIPNetmaskSortList |
| 42 | syn match resolvOptions /^options / nextgroup=resolvOption |
| 43 | |
| 44 | " Options |
| 45 | syn match resolvOption /\%(debug\|ndots:\d\)/ contained contains=resolvOperator |
| 46 | |
| 47 | " Additional errors |
| 48 | syn match resolvError /^search .\{257,}/ |
| 49 | syn match resolvNull /\s\{1,}$/ |
| 50 | |
| 51 | if version >= 508 || !exists("did_config_syntax_inits") |
| 52 | if version < 508 |
| 53 | let did_config_syntax_inits = 1 |
| 54 | command! -nargs=+ HiLink hi link <args> |
| 55 | else |
| 56 | command! -nargs=+ HiLink hi def link <args> |
| 57 | endif |
| 58 | |
| 59 | HiLink resolvIP Number |
| 60 | HiLink resolvIPNetmask Number |
| 61 | HiLink resolvHostname String |
| 62 | HiLink resolvOption String |
| 63 | |
| 64 | HiLink resolvIPNameserver Number |
| 65 | HiLink resolvHostnameSearch String |
| 66 | HiLink resolvIPNetmaskSortList Number |
| 67 | |
| 68 | HiLink resolvNameServer Identifier |
| 69 | HiLink resolvDomain Identifier |
| 70 | HiLink resolvSearch Identifier |
| 71 | HiLink resolvSortList Identifier |
| 72 | HiLink resolvOptions Identifier |
| 73 | |
| 74 | HiLink resolvComment Comment |
| 75 | HiLink resolvOperator Operator |
| 76 | HiLink resolvError Error |
| 77 | HiLink resolvIPError Error |
| 78 | HiLink resolvIPSpecial Special |
| 79 | |
| 80 | delcommand HiLink |
| 81 | endif |
| 82 | |
| 83 | let b:current_syntax = "resolv" |
| 84 | |
| 85 | " vim: ts=8 ft=vim |