Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Debian control files |
| 3 | " Maintainer: Wichert Akkerman <wakkerma@debian.org> |
| 4 | " Last Change: October 28, 2001 |
| 5 | |
| 6 | " Standard syntax initialization |
| 7 | if version < 600 |
| 8 | syntax clear |
| 9 | elseif exists("b:current_syntax") |
| 10 | finish |
| 11 | endif |
| 12 | |
| 13 | " Everything that is not explicitly matched by the rules below |
| 14 | syn match debcontrolElse "^.*$" |
| 15 | |
| 16 | " Common seperators |
| 17 | syn match debControlComma ", *" |
| 18 | syn match debControlSpace " " |
| 19 | |
| 20 | " Define some common expressions we can use later on |
| 21 | syn match debcontrolArchitecture contained "\(all\|any\|alpha\|arm\|hppa\|ia64\|i386\|m68k\|mipsel\|mips\|powerpc\|sh\|sheb\|sparc\|hurd-i386\)" |
| 22 | syn match debcontrolName contained "[a-z][a-z0-9+-]*" |
| 23 | syn match debcontrolPriority contained "\(extra\|important\|optional\|required\|standard\)" |
| 24 | syn match debcontrolSection contained "\(\(contrib\|non-free\|non-US/main\|non-US/contrib\|non-US/non-free\)/\)\=\(admin\|base\|comm\|devel\|doc\|editors\|electronics\|games\|graphics\|hamradio\|interpreters\|libs\|mail\|math\|misc\|net\|news\|oldlibs\|otherosfs\|science\|shells\|sound\|text\|tex\|utils\|web\|x11\|debian-installer\)" |
| 25 | syn match debcontrolVariable contained "\${.\{-}}" |
| 26 | |
| 27 | " An email address |
| 28 | syn match debcontrolEmail "[_=[:alnum:]\.+-]\+@[[:alnum:]\./\-]\+" |
| 29 | syn match debcontrolEmail "<.\{-}>" |
| 30 | |
| 31 | " List of all legal keys |
| 32 | 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\): *" |
| 33 | |
| 34 | " Fields for which we do strict syntax checking |
| 35 | syn region debcontrolStrictField start="^Architecture" end="$" contains=debcontrolKey,debcontrolArchitecture,debcontrolSpace oneline |
| 36 | syn region debcontrolStrictField start="^\(Package\|Source\)" end="$" contains=debcontrolKey,debcontrolName oneline |
| 37 | syn region debcontrolStrictField start="^Priority" end="$" contains=debcontrolKey,debcontrolPriority oneline |
| 38 | syn region debcontrolStrictField start="^Section" end="$" contains=debcontrolKey,debcontrolSection oneline |
| 39 | |
| 40 | " Catch-all for the other legal fields |
| 41 | syn 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\):" end="$" contains=debcontrolKey,debcontrolVariable,debcontrolEmail oneline |
| 42 | syn region debcontrolMultiField start="^\(Uploaders\|Description\):" skip="^ " end="^$"me=s-1 end="^[^ ]"me=s-1 contains=debcontrolKey,debcontrolEmail,debcontrolVariable |
| 43 | |
| 44 | " Associate our matches and regions with pretty colours |
| 45 | if version >= 508 || !exists("did_debcontrol_syn_inits") |
| 46 | if version < 508 |
| 47 | let did_debcontrol_syn_inits = 1 |
| 48 | command -nargs=+ HiLink hi link <args> |
| 49 | else |
| 50 | command -nargs=+ HiLink hi def link <args> |
| 51 | endif |
| 52 | |
| 53 | HiLink debcontrolKey Keyword |
| 54 | HiLink debcontrolField Normal |
| 55 | HiLink debcontrolStrictField Error |
| 56 | HiLink debcontrolMultiField Normal |
| 57 | HiLink debcontrolArchitecture Normal |
| 58 | HiLink debcontrolName Normal |
| 59 | HiLink debcontrolPriority Normal |
| 60 | HiLink debcontrolSection Normal |
| 61 | HiLink debcontrolVariable Identifier |
| 62 | HiLink debcontrolEmail Identifier |
| 63 | HiLink debcontrolElse Special |
| 64 | |
| 65 | delcommand HiLink |
| 66 | endif |
| 67 | |
| 68 | let b:current_syntax = "debcontrol" |
| 69 | |
| 70 | " vim: ts=8 sw=2 |