blob: f15e83cb61eeab336f826f09a52db33a963398fd [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: Debian control files
Bram Moolenaard68071d2006-05-02 22:08:30 +00003" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
4" Former Maintainers: Gerfried Fuchs <alfie@ist.org>
5" Wichert Akkerman <wakkerma@debian.org>
6" Last Change: $LastChangedDate: 2006-04-16 21:50:31 -0400 (Sun, 16 Apr 2006) $
7" URL: http://svn.debian.org/wsvn/pkg-vim/trunk/runtime/syntax/debcontrol.vim?op=file&rev=0&sc=0
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00008
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!
Bram Moolenaar071d4272004-06-13 20:20:40 +000012
13" Standard syntax initialization
14if version < 600
15 syntax clear
16elseif exists("b:current_syntax")
17 finish
18endif
19
20" Everything that is not explicitly matched by the rules below
21syn match debcontrolElse "^.*$"
22
23" Common seperators
24syn match debControlComma ", *"
25syn match debControlSpace " "
26
27" Define some common expressions we can use later on
Bram Moolenaard68071d2006-05-02 22:08:30 +000028syn match debcontrolArchitecture contained "\(all\|any\|alpha\|amd64\|arm\(eb\)\=\|hppa\|i386\|ia64\|m32r\|m68k\|mipsel\|mips\|powerpc\|ppc64\|s390\|sheb\|sh\|sparc64\|sparc\|hurd-i386\|kfreebsd-\(i386\|gnu\)\|knetbsd-i386\|netbsd-\(alpha\|i386\)\)"
Bram Moolenaar071d4272004-06-13 20:20:40 +000029syn match debcontrolName contained "[a-z][a-z0-9+-]*"
30syn match debcontrolPriority contained "\(extra\|important\|optional\|required\|standard\)"
Bram Moolenaar293ee4d2004-12-09 21:34:53 +000031syn 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\)"
Bram Moolenaar071d4272004-06-13 20:20:40 +000032syn match debcontrolVariable contained "\${.\{-}}"
33
34" An email address
35syn match debcontrolEmail "[_=[:alnum:]\.+-]\+@[[:alnum:]\./\-]\+"
36syn match debcontrolEmail "<.\{-}>"
37
38" List of all legal keys
Bram Moolenaar293ee4d2004-12-09 21:34:53 +000039syn 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\): *"
Bram Moolenaar071d4272004-06-13 20:20:40 +000040
41" Fields for which we do strict syntax checking
42syn region debcontrolStrictField start="^Architecture" end="$" contains=debcontrolKey,debcontrolArchitecture,debcontrolSpace oneline
43syn region debcontrolStrictField start="^\(Package\|Source\)" end="$" contains=debcontrolKey,debcontrolName oneline
44syn region debcontrolStrictField start="^Priority" end="$" contains=debcontrolKey,debcontrolPriority oneline
45syn region debcontrolStrictField start="^Section" end="$" contains=debcontrolKey,debcontrolSection oneline
46
47" Catch-all for the other legal fields
Bram Moolenaar293ee4d2004-12-09 21:34:53 +000048syn region debcontrolField start="^\(Maintainer\|Build-Depends\|Build-Conflicts\|Build-Depends-Indep\|Build-Conflicts-Indep\|Standards-Version\|Pre-Depends\|Depends\|Recommends\|Suggests\|Provides\|Replaces\|Conflicts\|Essential\|Bugs\|Origin\|Enhances\):" end="$" contains=debcontrolKey,debcontrolVariable,debcontrolEmail oneline
Bram Moolenaar071d4272004-06-13 20:20:40 +000049syn region debcontrolMultiField start="^\(Uploaders\|Description\):" skip="^ " end="^$"me=s-1 end="^[^ ]"me=s-1 contains=debcontrolKey,debcontrolEmail,debcontrolVariable
50
51" Associate our matches and regions with pretty colours
52if version >= 508 || !exists("did_debcontrol_syn_inits")
53 if version < 508
54 let did_debcontrol_syn_inits = 1
55 command -nargs=+ HiLink hi link <args>
56 else
57 command -nargs=+ HiLink hi def link <args>
58 endif
59
60 HiLink debcontrolKey Keyword
61 HiLink debcontrolField Normal
62 HiLink debcontrolStrictField Error
63 HiLink debcontrolMultiField Normal
64 HiLink debcontrolArchitecture Normal
65 HiLink debcontrolName Normal
66 HiLink debcontrolPriority Normal
67 HiLink debcontrolSection Normal
68 HiLink debcontrolVariable Identifier
69 HiLink debcontrolEmail Identifier
70 HiLink debcontrolElse Special
71
72 delcommand HiLink
73endif
74
75let b:current_syntax = "debcontrol"
76
77" vim: ts=8 sw=2