7
|
1 " Vim syntax file
|
2152
|
2 " Language: Debian control files
|
857
|
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>
|
2152
|
6 " Last Change: 2009 Aug 17
|
|
7 " URL: http://hg.debian.org/hg/pkg-vim/vim/raw-file/tip/runtime/syntax/debcontrol.vim
|
7
|
8
|
|
9 " Standard syntax initialization
|
|
10 if version < 600
|
|
11 syntax clear
|
|
12 elseif exists("b:current_syntax")
|
|
13 finish
|
|
14 endif
|
|
15
|
1624
|
16 " Should match case except for the keys of each field
|
|
17 syn case match
|
|
18
|
7
|
19 " Everything that is not explicitly matched by the rules below
|
|
20 syn match debcontrolElse "^.*$"
|
|
21
|
|
22 " Common seperators
|
|
23 syn match debControlComma ", *"
|
|
24 syn match debControlSpace " "
|
|
25
|
|
26 " Define some common expressions we can use later on
|
2152
|
27 syn match debcontrolArchitecture contained "\%(all\|any\|alpha\|amd64\|arm\%(e[bl]\)\=\|avr32\|hppa\|i386\|ia64\|lpia\|m32r\|m68k\|mips\%(el\)\=\|powerpc\|ppc64\|s390x\=\|sh[34]\(eb\)\=\|sh\|sparc\%(64\)\=\|hurd-i386\|kfreebsd-\%(i386\|amd64\|gnu\)\|knetbsd-i386\|kopensolaris-i386\|netbsd-\%(alpha\|i386\)\)"
|
1624
|
28 syn match debcontrolName contained "[a-z0-9][a-z0-9+.-]\+"
|
7
|
29 syn match debcontrolPriority contained "\(extra\|important\|optional\|required\|standard\)"
|
2034
|
30 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|misc|net|news|ocaml|oldlibs|otherosfs|perl|php|python|ruby|science|shells|sound|text|tex|utils|vcs|video|web|x11|xfce|zope)"
|
1624
|
31 syn match debcontrolPackageType contained "u\?deb"
|
7
|
32 syn match debcontrolVariable contained "\${.\{-}}"
|
1668
|
33 syn match debcontrolDmUpload contained "\cyes"
|
7
|
34
|
1624
|
35 " A URL (using the domain name definitions from RFC 1034 and 1738), right now
|
|
36 " only enforce protocol and some sanity on the server/path part;
|
|
37 syn match debcontrolHTTPUrl contained "\vhttps?://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$"
|
|
38 syn match debcontrolVcsSvn contained "\vsvn%(\+ssh)?://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$"
|
|
39 syn match debcontrolVcsCvs contained "\v%(\-d *)?:pserver:[^@]+\@[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?:/[^[:space:]]*%( [^[:space:]]+)?$"
|
2034
|
40 syn match debcontrolVcsGit contained "\v%(git|http)://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$"
|
1624
|
41
|
7
|
42 " An email address
|
|
43 syn match debcontrolEmail "[_=[:alnum:]\.+-]\+@[[:alnum:]\./\-]\+"
|
|
44 syn match debcontrolEmail "<.\{-}>"
|
|
45
|
1624
|
46 " #-Comments
|
|
47 syn match debcontrolComment "^#.*$"
|
|
48
|
|
49 syn case ignore
|
|
50
|
7
|
51 " List of all legal keys
|
2152
|
52 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\|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\): *"
|
7
|
53
|
|
54 " Fields for which we do strict syntax checking
|
|
55 syn region debcontrolStrictField start="^Architecture" end="$" contains=debcontrolKey,debcontrolArchitecture,debcontrolSpace oneline
|
|
56 syn region debcontrolStrictField start="^\(Package\|Source\)" end="$" contains=debcontrolKey,debcontrolName oneline
|
|
57 syn region debcontrolStrictField start="^Priority" end="$" contains=debcontrolKey,debcontrolPriority oneline
|
|
58 syn region debcontrolStrictField start="^Section" end="$" contains=debcontrolKey,debcontrolSection oneline
|
1624
|
59 syn region debcontrolStrictField start="^XC-Package-Type" end="$" contains=debcontrolKey,debcontrolPackageType oneline
|
|
60 syn region debcontrolStrictField start="^Homepage" end="$" contains=debcontrolKey,debcontrolHTTPUrl oneline keepend
|
2034
|
61 syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-\%(Browser\|Arch\|Bzr\|Darcs\|Hg\)" end="$" contains=debcontrolKey,debcontrolHTTPUrl oneline keepend
|
|
62 syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-Svn" end="$" contains=debcontrolKey,debcontrolVcsSvn,debcontrolHTTPUrl oneline keepend
|
|
63 syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-Cvs" end="$" contains=debcontrolKey,debcontrolVcsCvs oneline keepend
|
|
64 syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-Git" end="$" contains=debcontrolKey,debcontrolVcsGit oneline keepend
|
|
65 syn region debcontrolStrictField start="^\%(XS-\)\=DM-Upload-Allowed" end="$" contains=debcontrolKey,debcontrolDmUpload oneline
|
7
|
66
|
|
67 " Catch-all for the other legal fields
|
2034
|
68 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
|
2152
|
69 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
|
7
|
70
|
|
71 " Associate our matches and regions with pretty colours
|
|
72 if version >= 508 || !exists("did_debcontrol_syn_inits")
|
|
73 if version < 508
|
|
74 let did_debcontrol_syn_inits = 1
|
|
75 command -nargs=+ HiLink hi link <args>
|
|
76 else
|
|
77 command -nargs=+ HiLink hi def link <args>
|
|
78 endif
|
|
79
|
|
80 HiLink debcontrolKey Keyword
|
|
81 HiLink debcontrolField Normal
|
|
82 HiLink debcontrolStrictField Error
|
|
83 HiLink debcontrolMultiField Normal
|
|
84 HiLink debcontrolArchitecture Normal
|
|
85 HiLink debcontrolName Normal
|
|
86 HiLink debcontrolPriority Normal
|
|
87 HiLink debcontrolSection Normal
|
1624
|
88 HiLink debcontrolPackageType Normal
|
7
|
89 HiLink debcontrolVariable Identifier
|
|
90 HiLink debcontrolEmail Identifier
|
1624
|
91 HiLink debcontrolVcsSvn Identifier
|
|
92 HiLink debcontrolVcsCvs Identifier
|
|
93 HiLink debcontrolVcsGit Identifier
|
|
94 HiLink debcontrolHTTPUrl Identifier
|
1668
|
95 HiLink debcontrolDmUpload Identifier
|
1624
|
96 HiLink debcontrolComment Comment
|
7
|
97 HiLink debcontrolElse Special
|
|
98
|
|
99 delcommand HiLink
|
|
100 endif
|
|
101
|
|
102 let b:current_syntax = "debcontrol"
|
|
103
|
|
104 " vim: ts=8 sw=2
|