Mercurial > vim
annotate runtime/syntax/debcontrol.vim @ 9287:af25a1a875db v7.4.1926
commit https://github.com/vim/vim/commit/a890f5e34887bff7616bdb4b9ee0bf98c8d2a8f0
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 12 23:03:19 2016 +0200
patch 7.4.1926
Problem: Possible crash with many history items.
Solution: Avoid the index going past the last item.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 12 Jun 2016 23:15:07 +0200 |
parents | aea5ebf352c4 |
children | 43efa4f5a8ea |
rev | line source |
---|---|
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> | |
7384
aea5ebf352c4
commit https://github.com/vim/vim/commit/256972a9849b5d575b62a6a71be5b6934b5b0e8b
Christian Brabandt <cb@256bit.org>
parents:
6823
diff
changeset
|
6 " Last Change: 2015 Oct 24 |
aea5ebf352c4
commit https://github.com/vim/vim/commit/256972a9849b5d575b62a6a71be5b6934b5b0e8b
Christian Brabandt <cb@256bit.org>
parents:
6823
diff
changeset
|
7 " URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/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 | |
6070
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
16 let s:cpo_save = &cpo |
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
17 set cpo&vim |
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
18 |
1624 | 19 " Should match case except for the keys of each field |
20 syn case match | |
21 | |
7 | 22 " Everything that is not explicitly matched by the rules below |
23 syn match debcontrolElse "^.*$" | |
24 | |
25 " Common seperators | |
26 syn match debControlComma ", *" | |
27 syn match debControlSpace " " | |
28 | |
6070
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
29 let s:kernels = '\%(linux\|hurd\|kfreebsd\|knetbsd\|kopensolaris\|netbsd\)' |
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
30 let s:archs = '\%(alpha\|amd64\|armeb\|armel\|armhf\|arm64\|avr32\|hppa\|i386' |
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
31 \ . '\|ia64\|lpia\|m32r\|m68k\|mipsel\|mips\|powerpcspe\|powerpc\|ppc64el' |
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
32 \ . '\|ppc64\|s390x\|s390\|sh3eb\|sh3\|sh4eb\|sh4\|sh\|sparc64\|sparc\|x32\)' |
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
33 let s:pairs = 'hurd-i386\|kfreebsd-i386\|kfreebsd-amd64\|knetbsd-i386\|kopensolaris-i386\|netbsd-alpha\|netbsd-i386' |
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
34 |
7 | 35 " Define some common expressions we can use later on |
6070
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
36 exe 'syn match debcontrolArchitecture contained "\%(all\|'. s:kernels .'-any\|\%(any-\)\='. s:archs .'\|'. s:pairs .'\|any\)"' |
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
37 |
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
38 unlet s:kernels s:archs s:pairs |
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
39 |
2908 | 40 syn match debcontrolMultiArch contained "\%(no\|foreign\|allowed\|same\)" |
1624 | 41 syn match debcontrolName contained "[a-z0-9][a-z0-9+.-]\+" |
7 | 42 syn match debcontrolPriority contained "\(extra\|important\|optional\|required\|standard\)" |
3513 | 43 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|education|electronics|embedded|fonts|games|gnome|gnustep|gnu-r|graphics|hamradio|haskell|httpd|interpreters|introspection|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)" |
1624 | 44 syn match debcontrolPackageType contained "u\?deb" |
7 | 45 syn match debcontrolVariable contained "\${.\{-}}" |
1668 | 46 syn match debcontrolDmUpload contained "\cyes" |
7 | 47 |
1624 | 48 " A URL (using the domain name definitions from RFC 1034 and 1738), right now |
49 " only enforce protocol and some sanity on the server/path part; | |
50 syn match debcontrolHTTPUrl contained "\vhttps?://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$" | |
51 syn match debcontrolVcsSvn contained "\vsvn%(\+ssh)?://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$" | |
52 syn match debcontrolVcsCvs contained "\v%(\-d *)?:pserver:[^@]+\@[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?:/[^[:space:]]*%( [^[:space:]]+)?$" | |
6823 | 53 syn match debcontrolVcsGit contained "\v%(git|https?)://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?%(\s+-b\s+[^ ~^:?*[\\]+)?$" |
1624 | 54 |
7 | 55 " An email address |
56 syn match debcontrolEmail "[_=[:alnum:]\.+-]\+@[[:alnum:]\./\-]\+" | |
57 syn match debcontrolEmail "<.\{-}>" | |
58 | |
1624 | 59 " #-Comments |
3893 | 60 syn match debcontrolComment "^#.*$" contains=@Spell |
1624 | 61 |
62 syn case ignore | |
63 | |
7 | 64 " List of all legal keys |
4229 | 65 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\): *" |
66 | |
67 syn match debcontrolDeprecatedKey contained "^\%(\%(XS-\)\=DM-Upload-Allowed\): *" | |
7 | 68 |
69 " Fields for which we do strict syntax checking | |
70 syn region debcontrolStrictField start="^Architecture" end="$" contains=debcontrolKey,debcontrolArchitecture,debcontrolSpace oneline | |
2908 | 71 syn region debcontrolStrictField start="^Multi-Arch" end="$" contains=debcontrolKey,debcontrolMultiArch oneline |
7 | 72 syn region debcontrolStrictField start="^\(Package\|Source\)" end="$" contains=debcontrolKey,debcontrolName oneline |
73 syn region debcontrolStrictField start="^Priority" end="$" contains=debcontrolKey,debcontrolPriority oneline | |
74 syn region debcontrolStrictField start="^Section" end="$" contains=debcontrolKey,debcontrolSection oneline | |
2908 | 75 syn region debcontrolStrictField start="^\%(XC-\)\=Package-Type" end="$" contains=debcontrolKey,debcontrolPackageType oneline |
1624 | 76 syn region debcontrolStrictField start="^Homepage" end="$" contains=debcontrolKey,debcontrolHTTPUrl oneline keepend |
2034 | 77 syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-\%(Browser\|Arch\|Bzr\|Darcs\|Hg\)" end="$" contains=debcontrolKey,debcontrolHTTPUrl oneline keepend |
78 syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-Svn" end="$" contains=debcontrolKey,debcontrolVcsSvn,debcontrolHTTPUrl oneline keepend | |
79 syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-Cvs" end="$" contains=debcontrolKey,debcontrolVcsCvs oneline keepend | |
80 syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-Git" end="$" contains=debcontrolKey,debcontrolVcsGit oneline keepend | |
4229 | 81 syn region debcontrolStrictField start="^\%(XS-\)\=DM-Upload-Allowed" end="$" contains=debcontrolDeprecatedKey,debcontrolDmUpload oneline |
7 | 82 |
83 " Catch-all for the other legal fields | |
2034 | 84 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 | 85 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 |
3893 | 86 syn region debcontrolMultiFieldSpell start="^\%(Description\):" skip="^ " end="^$"me=s-1 end="^[^ #]"me=s-1 contains=debcontrolKey,debcontrolEmail,debcontrolVariable,debcontrolComment,@Spell |
7 | 87 |
88 " Associate our matches and regions with pretty colours | |
89 if version >= 508 || !exists("did_debcontrol_syn_inits") | |
90 if version < 508 | |
91 let did_debcontrol_syn_inits = 1 | |
92 command -nargs=+ HiLink hi link <args> | |
93 else | |
94 command -nargs=+ HiLink hi def link <args> | |
95 endif | |
96 | |
97 HiLink debcontrolKey Keyword | |
98 HiLink debcontrolField Normal | |
99 HiLink debcontrolStrictField Error | |
4229 | 100 HiLink debcontrolDeprecatedKey Error |
7 | 101 HiLink debcontrolMultiField Normal |
102 HiLink debcontrolArchitecture Normal | |
2908 | 103 HiLink debcontrolMultiArch Normal |
7 | 104 HiLink debcontrolName Normal |
105 HiLink debcontrolPriority Normal | |
106 HiLink debcontrolSection Normal | |
1624 | 107 HiLink debcontrolPackageType Normal |
7 | 108 HiLink debcontrolVariable Identifier |
109 HiLink debcontrolEmail Identifier | |
1624 | 110 HiLink debcontrolVcsSvn Identifier |
111 HiLink debcontrolVcsCvs Identifier | |
112 HiLink debcontrolVcsGit Identifier | |
113 HiLink debcontrolHTTPUrl Identifier | |
1668 | 114 HiLink debcontrolDmUpload Identifier |
1624 | 115 HiLink debcontrolComment Comment |
7 | 116 HiLink debcontrolElse Special |
117 | |
118 delcommand HiLink | |
119 endif | |
120 | |
121 let b:current_syntax = "debcontrol" | |
122 | |
6070
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
123 let &cpo = s:cpo_save |
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
124 unlet s:cpo_save |
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
125 |
7 | 126 " vim: ts=8 sw=2 |