2 " Language: Debian control files
3 " 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: 2011 Sep 17
7 " URL: http://anonscm.debian.org/hg/pkg-vim/vim/raw-file/unstable/runtime/syntax/debcontrol.vim
9 " Standard syntax initialization
12 elseif exists("b:current_syntax")
16 " Should match case except for the keys of each field
19 " Everything that is not explicitly matched by the rules below
20 syn match debcontrolElse "^.*$"
23 syn match debControlComma ", *"
24 syn match debControlSpace " "
26 " Define some common expressions we can use later on
27 syn match debcontrolArchitecture contained "\%(all\|linux-any\|\%(any-\)\=\%(alpha\|amd64\|arm\%(e[bl]\|hf\)\=\|avr32\|hppa\|i386\|ia64\|lpia\|m32r\|m68k\|mips\%(el\)\=\|powerpc\|ppc64\|s390x\=\|sh[34]\(eb\)\=\|sh\|sparc\%(64\)\=\)\|hurd-\%(i386\|any\)\|kfreebsd-\%(i386\|amd64\|any\)\|knetbsd-\%(i386\|any\)\|kopensolaris-\%(i386\|any\)\|netbsd-\%(alpha\|i386\|any\)\|any\)"
28 syn match debcontrolMultiArch contained "\%(no\|foreign\|allowed\|same\)"
29 syn match debcontrolName contained "[a-z0-9][a-z0-9+.-]\+"
30 syn match debcontrolPriority contained "\(extra\|important\|optional\|required\|standard\)"
31 syn match debcontrolSection contained "\v((contrib|non-free|non-US/main|non-US/contrib|non-US/non-free|restricted|universe|multiverse)/)?(admin|cli-mono|comm|database|debian-installer|debug|devel|doc|editors|electronics|embedded|fonts|games|gnome|gnustep|gnu-r|graphics|hamradio|haskell|httpd|interpreters|java|kde|kernel|libs|libdevel|lisp|localization|mail|math|metapackages|misc|net|news|ocaml|oldlibs|otherosfs|perl|php|python|ruby|science|shells|sound|text|tex|utils|vcs|video|web|x11|xfce|zope)"
32 syn match debcontrolPackageType contained "u\?deb"
33 syn match debcontrolVariable contained "\${.\{-}}"
34 syn match debcontrolDmUpload contained "\cyes"
36 " A URL (using the domain name definitions from RFC 1034 and 1738), right now
37 " only enforce protocol and some sanity on the server/path part;
38 syn match debcontrolHTTPUrl contained "\vhttps?://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$"
39 syn match debcontrolVcsSvn contained "\vsvn%(\+ssh)?://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$"
40 syn match debcontrolVcsCvs contained "\v%(\-d *)?:pserver:[^@]+\@[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?:/[^[:space:]]*%( [^[:space:]]+)?$"
41 syn match debcontrolVcsGit contained "\v%(git|http)://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$"
44 syn match debcontrolEmail "[_=[:alnum:]\.+-]\+@[[:alnum:]\./\-]\+"
45 syn match debcontrolEmail "<.\{-}>"
48 syn match debcontrolComment "^#.*$"
52 " List of all legal keys
53 syn match debcontrolKey contained "^\%(Source\|Package\|Section\|Priority\|\%(XSBC-Original-\)\=Maintainer\|Uploaders\|Build-\%(Conflicts\|Depends\)\%(-Indep\)\=\|Standards-Version\|\%(Pre-\)\=Depends\|Recommends\|Suggests\|Provides\|Replaces\|Conflicts\|Enhances\|Breaks\|Essential\|Architecture\|Multi-Arch\|Description\|Bugs\|Origin\|X[SB]-Python-Version\|Homepage\|\(XS-\)\=Vcs-\(Browser\|Arch\|Bzr\|Cvs\|Darcs\|Git\|Hg\|Mtn\|Svn\)\|\%(XC-\)\=Package-Type\|\%(XS-\)\=DM-Upload-Allowed\): *"
55 " Fields for which we do strict syntax checking
56 syn region debcontrolStrictField start="^Architecture" end="$" contains=debcontrolKey,debcontrolArchitecture,debcontrolSpace oneline
57 syn region debcontrolStrictField start="^Multi-Arch" end="$" contains=debcontrolKey,debcontrolMultiArch oneline
58 syn region debcontrolStrictField start="^\(Package\|Source\)" end="$" contains=debcontrolKey,debcontrolName oneline
59 syn region debcontrolStrictField start="^Priority" end="$" contains=debcontrolKey,debcontrolPriority oneline
60 syn region debcontrolStrictField start="^Section" end="$" contains=debcontrolKey,debcontrolSection oneline
61 syn region debcontrolStrictField start="^\%(XC-\)\=Package-Type" end="$" contains=debcontrolKey,debcontrolPackageType oneline
62 syn region debcontrolStrictField start="^Homepage" end="$" contains=debcontrolKey,debcontrolHTTPUrl oneline keepend
63 syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-\%(Browser\|Arch\|Bzr\|Darcs\|Hg\)" end="$" contains=debcontrolKey,debcontrolHTTPUrl oneline keepend
64 syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-Svn" end="$" contains=debcontrolKey,debcontrolVcsSvn,debcontrolHTTPUrl oneline keepend
65 syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-Cvs" end="$" contains=debcontrolKey,debcontrolVcsCvs oneline keepend
66 syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-Git" end="$" contains=debcontrolKey,debcontrolVcsGit oneline keepend
67 syn region debcontrolStrictField start="^\%(XS-\)\=DM-Upload-Allowed" end="$" contains=debcontrolKey,debcontrolDmUpload oneline
69 " Catch-all for the other legal fields
70 syn region debcontrolField start="^\%(\%(XSBC-Original-\)\=Maintainer\|Standards-Version\|Essential\|Bugs\|Origin\|X[SB]-Python-Version\|\%(XS-\)\=Vcs-Mtn\):" end="$" contains=debcontrolKey,debcontrolVariable,debcontrolEmail oneline
71 syn region debcontrolMultiField start="^\%(Build-\%(Conflicts\|Depends\)\%(-Indep\)\=\|\%(Pre-\)\=Depends\|Recommends\|Suggests\|Provides\|Replaces\|Conflicts\|Enhances\|Breaks\|Uploaders\|Description\):" skip="^ " end="^$"me=s-1 end="^[^ #]"me=s-1 contains=debcontrolKey,debcontrolEmail,debcontrolVariable,debcontrolComment
73 " Associate our matches and regions with pretty colours
74 if version >= 508 || !exists("did_debcontrol_syn_inits")
76 let did_debcontrol_syn_inits = 1
77 command -nargs=+ HiLink hi link <args>
79 command -nargs=+ HiLink hi def link <args>
82 HiLink debcontrolKey Keyword
83 HiLink debcontrolField Normal
84 HiLink debcontrolStrictField Error
85 HiLink debcontrolMultiField Normal
86 HiLink debcontrolArchitecture Normal
87 HiLink debcontrolMultiArch Normal
88 HiLink debcontrolName Normal
89 HiLink debcontrolPriority Normal
90 HiLink debcontrolSection Normal
91 HiLink debcontrolPackageType Normal
92 HiLink debcontrolVariable Identifier
93 HiLink debcontrolEmail Identifier
94 HiLink debcontrolVcsSvn Identifier
95 HiLink debcontrolVcsCvs Identifier
96 HiLink debcontrolVcsGit Identifier
97 HiLink debcontrolHTTPUrl Identifier
98 HiLink debcontrolDmUpload Identifier
99 HiLink debcontrolComment Comment
100 HiLink debcontrolElse Special
105 let b:current_syntax = "debcontrol"