| 1 |
" Vim syntax file
|
| 2 |
" Language: Debian control files
|
| 3 |
" Maintainer: Gerfried Fuchs <alfie@debian.org>
|
| 4 |
" Last Change: 15. March 2005
|
| 5 |
" URL: http://alfie.ist.org/projects/vim/syntax/debcontrol.vim
|
| 6 |
"
|
| 7 |
" Original Version: Wichert Akkerman <wakkerma@debian.org>
|
| 8 |
|
| 9 |
" Comments are very welcome - but please make sure that you are commenting on
|
| 10 |
" the latest version of this file.
|
| 11 |
" SPAM is _NOT_ welcome - be ready to be reported!
|
| 12 |
|
| 13 |
" Standard syntax initialization
|
| 14 |
if version < 600
|
| 15 |
syntax clear
|
| 16 |
elseif exists("b:current_syntax")
|
| 17 |
finish
|
| 18 |
endif
|
| 19 |
|
| 20 |
" Everything that is not explicitly matched by the rules below
|
| 21 |
syn match debcontrolElse "^.*$"
|
| 22 |
|
| 23 |
" Common seperators
|
| 24 |
syn match debControlComma ", *"
|
| 25 |
syn match debControlSpace " "
|
| 26 |
|
| 27 |
" Define some common expressions we can use later on
|
| 28 |
syn match debcontrolArchitecture contained "\(all\|any\|alpha\|amd64\|arm\|hppa\|i386\|ia64\|m68k\|mipsel\|mips\|powerpc\|s390\|sheb\|sh\|sparc64\|sparc\|hurd-i386\|kfreebsd-i386\|knetbsd-i386\|netbsd-i386\)"
|
| 29 |
syn match debcontrolName contained "\<\([0-9+-.]*[a-z][a-z0-9+-.]*\)\>"
|
| 30 |
syn match debcontrolPriority contained "\(extra\|important\|optional\|required\|standard\)"
|
| 31 |
syn match debcontrolSection contained "\(\(contrib\|non-free\|non-US/main\|non-US/contrib\|non-US/non-free\)/\)\=\(admin\|base\|comm\|devel\|doc\|editors\|electronics\|embedded\|games\|gnome\|graphics\|hamradio\|interpreters\|kde\|libs\|libdevel\|mail\|math\|misc\|net\|news\|oldlibs\|otherosfs\|perl\|python\|science\|shells\|sound\|text\|tex\|utils\|web\|x11\|debian-installer\)"
|
| 32 |
syn match debcontrolVariable contained "\${.\{-}}"
|
| 33 |
|
| 34 |
" An email address
|
| 35 |
syn match debcontrolEmail "[_=[:alnum:]\.+-]\+@[[:alnum:]\./\-]\+"
|
| 36 |
syn match debcontrolEmail "<.\{-}>"
|
| 37 |
|
| 38 |
" List of all legal keys
|
| 39 |
syn match debcontrolKey contained "^\(Source\|Package\|Section\|Priority\|Maintainer\|Uploaders\|Build-Depends\|Build-Conflicts\|Build-Depends-Indep\|Build-Conflicts-Indep\|Standards-Version\|Pre-Depends\|Depends\|Recommends\|Suggests\|Provides\|Replaces\|Conflicts\|Essential\|Architecture\|Description\|Bugs\|Origin\|Enhances\): *"
|
| 40 |
|
| 41 |
" Fields for which we do strict syntax checking
|
| 42 |
syn region debcontrolStrictField start="^Architecture" end="$" contains=debcontrolKey,debcontrolArchitecture,debcontrolSpace oneline
|
| 43 |
syn region debcontrolStrictField start="^\(Package\|Source\)" end="$" contains=debcontrolKey,debcontrolName oneline
|
| 44 |
syn region debcontrolStrictField start="^Priority" end="$" contains=debcontrolKey,debcontrolPriority oneline
|
| 45 |
syn region debcontrolStrictField start="^Section" end="$" contains=debcontrolKey,debcontrolSection oneline
|
| 46 |
|
| 47 |
" Catch-all for the other legal fields
|
| 48 |
syn region debcontrolField start="^\(Build-Depends\|Build-Conflicts\|Build-Depends-Indep\|Build-Conflicts-Indep\|Standards-Version\|Pre-Depends\|Depends\|Recommends\|Suggests\|Provides\|Replaces\|Conflicts\|Essential\|Origin\|Enhances\):" end="$" contains=debcontrolKey,debcontrolVariable oneline
|
| 49 |
syn region debcontrolField start="^\(Maintainer\|Bugs\):" end="$" contains=debcontrolKey,debcontrolVariable,debcontrolEmail oneline
|
| 50 |
syn region debcontrolMultiField start="^\(Uploaders\|Description\):" skip="^ " end="^$"me=s-1 end="^[^ ]"me=s-1 contains=debcontrolKey,debcontrolEmail,debcontrolVariable
|
| 51 |
|
| 52 |
" Associate our matches and regions with pretty colours
|
| 53 |
if version >= 508 || !exists("did_debcontrol_syn_inits")
|
| 54 |
if version < 508
|
| 55 |
let did_debcontrol_syn_inits = 1
|
| 56 |
command -nargs=+ HiLink hi link <args>
|
| 57 |
else
|
| 58 |
command -nargs=+ HiLink hi def link <args>
|
| 59 |
endif
|
| 60 |
|
| 61 |
HiLink debcontrolKey Keyword
|
| 62 |
HiLink debcontrolField Normal
|
| 63 |
HiLink debcontrolStrictField Error
|
| 64 |
HiLink debcontrolMultiField Normal
|
| 65 |
HiLink debcontrolArchitecture Normal
|
| 66 |
HiLink debcontrolName Normal
|
| 67 |
HiLink debcontrolPriority Normal
|
| 68 |
HiLink debcontrolSection Normal
|
| 69 |
HiLink debcontrolVariable Identifier
|
| 70 |
HiLink debcontrolEmail Identifier
|
| 71 |
HiLink debcontrolElse Special
|
| 72 |
|
| 73 |
delcommand HiLink
|
| 74 |
endif
|
| 75 |
|
| 76 |
let b:current_syntax = "debcontrol"
|
| 77 |
|
| 78 |
" vim: ts=8 sw=2
|