Mercurial > vim
annotate runtime/syntax/debcontrol.vim @ 20924:c8f68af254b6
Added tag v8.2.1013 for changeset a9516192b1db348f81f425b5c3efd4241ea2c19d
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 19 Jun 2020 19:15:05 +0200 |
parents | 5c5908e81e93 |
children | 8dad79c661d1 |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2152 | 2 " Language: Debian control files |
13231 | 3 " Maintainer: Debian Vim Maintainers |
857 | 4 " Former Maintainers: Gerfried Fuchs <alfie@ist.org> |
5 " Wichert Akkerman <wakkerma@debian.org> | |
14519 | 6 " Last Change: 2018 Aug 11 |
13231 | 7 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debcontrol.vim |
7 | 8 |
9 " Standard syntax initialization | |
13857 | 10 if exists('b:current_syntax') |
7 | 11 finish |
12 endif | |
13 | |
6070
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
14 let s:cpo_save = &cpo |
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
15 set cpo&vim |
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
16 |
1624 | 17 " Should match case except for the keys of each field |
18 syn case match | |
19 | |
12826 | 20 syn iskeyword @,48-57,-,/ |
21 | |
7 | 22 " Everything that is not explicitly matched by the rules below |
23 syn match debcontrolElse "^.*$" | |
24 | |
25 " Common seperators | |
12254 | 26 syn match debControlComma ",[ \t]*" |
27 syn match debControlSpace "[ \t]" | |
7 | 28 |
12826 | 29 let s:kernels = ['linux', 'hurd', 'kfreebsd', 'knetbsd', 'kopensolaris', 'netbsd'] |
30 let s:archs = [ | |
31 \ 'alpha', 'amd64', 'armeb', 'armel', 'armhf', 'arm64', 'avr32', 'hppa' | |
32 \, 'i386', 'ia64', 'lpia', 'm32r', 'm68k', 'mipsel', 'mips64el', 'mips' | |
14519 | 33 \, 'powerpcspe', 'powerpc', 'ppc64el', 'ppc64', 'riscv64', 's390x', 's390', 'sh3eb' |
12826 | 34 \, 'sh3', 'sh4eb', 'sh4', 'sh', 'sparc64', 'sparc', 'x32' |
35 \ ] | |
36 let s:pairs = [ | |
37 \ 'hurd-i386', 'kfreebsd-i386', 'kfreebsd-amd64', 'knetbsd-i386' | |
38 \, 'kopensolaris-i386', 'netbsd-alpha', 'netbsd-i386' | |
39 \ ] | |
6070
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
40 |
7 | 41 " Define some common expressions we can use later on |
12826 | 42 syn keyword debcontrolArchitecture contained all any |
14123 | 43 exe 'syn keyword debcontrolArchitecture contained '. join(map(copy(s:kernels), {k,v -> v .'-any'})) |
44 exe 'syn keyword debcontrolArchitecture contained '. join(map(copy(s:archs), {k,v -> 'any-'.v})) | |
12826 | 45 exe 'syn keyword debcontrolArchitecture contained '. join(s:archs) |
46 exe 'syn keyword debcontrolArchitecture contained '. join(s:pairs) | |
6070
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
47 |
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
48 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
|
49 |
12826 | 50 let s:sections = [ |
51 \ 'admin', 'cli-mono', 'comm', 'database', 'debian-installer', 'debug' | |
52 \, 'devel', 'doc', 'editors', 'education', 'electronics', 'embedded' | |
53 \, 'fonts', 'games', 'gnome', 'gnustep', 'gnu-r', 'golang', 'graphics' | |
54 \, 'hamradio', 'haskell', 'httpd', 'interpreters', 'introspection' | |
13231 | 55 \, 'java\%(script\)\=', 'kde', 'kernel', 'libs', 'libdevel', 'lisp' |
12826 | 56 \, 'localization', 'mail', 'math', 'metapackages', 'misc', 'net' |
57 \, 'news', 'ocaml', 'oldlibs', 'otherosfs', 'perl', 'php', 'python' | |
58 \, 'ruby', 'rust', 'science', 'shells', 'sound', 'text', 'tex' | |
59 \, 'utils', 'vcs', 'video', 'web', 'x11', 'xfce', 'zope' | |
60 \ ] | |
61 | |
62 syn keyword debcontrolMultiArch contained no foreign allowed same | |
1624 | 63 syn match debcontrolName contained "[a-z0-9][a-z0-9+.-]\+" |
12826 | 64 syn keyword debcontrolPriority contained extra important optional required standard |
65 exe 'syn match debcontrolSection contained "\%(\%(contrib\|non-free\|non-US/main\|non-US/contrib\|non-US/non-free\|restricted\|universe\|multiverse\)/\)\=\%('.join(s:sections, '\|').'\)"' | |
66 syn keyword debcontrolPackageType contained udeb deb | |
7 | 67 syn match debcontrolVariable contained "\${.\{-}}" |
12826 | 68 syn keyword debcontrolDmUpload contained yes |
69 syn keyword debcontrolYesNo contained yes no | |
70 syn match debcontrolR3 contained "\<\%(no\|binary-targets\|[[:graph:]]\+/[[:graph:]]\+\%( \+[[:graph:]]\+/[[:graph:]]\+\)*\)\>" | |
71 | |
72 unlet s:sections | |
7 | 73 |
1624 | 74 " A URL (using the domain name definitions from RFC 1034 and 1738), right now |
75 " only enforce protocol and some sanity on the server/path part; | |
76 syn match debcontrolHTTPUrl contained "\vhttps?://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$" | |
77 syn match debcontrolVcsSvn contained "\vsvn%(\+ssh)?://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$" | |
78 syn match debcontrolVcsCvs contained "\v%(\-d *)?:pserver:[^@]+\@[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?:/[^[:space:]]*%( [^[:space:]]+)?$" | |
6823 | 79 syn match debcontrolVcsGit contained "\v%(git|https?)://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?%(\s+-b\s+[^ ~^:?*[\\]+)?$" |
1624 | 80 |
7 | 81 " An email address |
82 syn match debcontrolEmail "[_=[:alnum:]\.+-]\+@[[:alnum:]\./\-]\+" | |
83 syn match debcontrolEmail "<.\{-}>" | |
84 | |
1624 | 85 " #-Comments |
3893 | 86 syn match debcontrolComment "^#.*$" contains=@Spell |
1624 | 87 |
88 syn case ignore | |
89 | |
13231 | 90 " Handle all fields from deb-src-control(5) |
7 | 91 |
92 " Fields for which we do strict syntax checking | |
13231 | 93 syn region debcontrolStrictField matchgroup=debcontrolKey start="^Architecture: *" end="$" contains=debcontrolArchitecture,debcontrolSpace oneline |
94 syn region debcontrolStrictField matchgroup=debcontrolKey start="^Multi-Arch: *" end="$" contains=debcontrolMultiArch oneline | |
95 syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(Package\|Source\): *" end="$" contains=debcontrolName oneline | |
96 syn region debcontrolStrictField matchgroup=debcontrolKey start="^Priority: *" end="$" contains=debcontrolPriority oneline | |
97 syn region debcontrolStrictField matchgroup=debcontrolKey start="^Section: *" end="$" contains=debcontrolSection oneline | |
98 syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XC-\)\=Package-Type: *" end="$" contains=debcontrolPackageType oneline | |
99 syn region debcontrolStrictField matchgroup=debcontrolKey start="^Homepage: *" end="$" contains=debcontrolHTTPUrl oneline keepend | |
100 syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XS-\)\=Vcs-\%(Browser\|Arch\|Bzr\|Darcs\|Hg\): *" end="$" contains=debcontrolHTTPUrl oneline keepend | |
101 syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XS-\)\=Vcs-Svn: *" end="$" contains=debcontrolVcsSvn,debcontrolHTTPUrl oneline keepend | |
102 syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XS-\)\=Vcs-Cvs: *" end="$" contains=debcontrolVcsCvs oneline keepend | |
103 syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XS-\)\=Vcs-Git: *" end="$" contains=debcontrolVcsGit oneline keepend | |
104 syn region debcontrolStrictField matchgroup=debcontrolKey start="^Rules-Requires-Root: *" end="$" contains=debcontrolR3 oneline | |
105 syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(Build-\)\=Essential: *" end="$" contains=debcontrolYesNo oneline | |
106 | |
107 syn region debcontrolStrictField matchgroup=debcontrolDeprecatedKey start="^\%(XS-\)\=DM-Upload-Allowed: *" end="$" contains=debcontrolDmUpload oneline | |
7 | 108 |
109 " Catch-all for the other legal fields | |
13231 | 110 syn region debcontrolField matchgroup=debcontrolKey start="^\%(\%(XSBC-Original-\)\=Maintainer\|Standards-Version\|Bugs\|Origin\|X[SB]-Python-Version\|\%(XS-\)\=Vcs-Mtn\|\%(XS-\)\=Testsuite\%(-Triggers\)\=\|Build-Profiles\|Tag\|Subarchitecture\|Kernel-Version\|Installer-Menu-Item\): " end="$" contains=debcontrolVariable,debcontrolEmail oneline |
111 syn region debcontrolMultiField matchgroup=debcontrolKey start="^\%(Build-\%(Conflicts\|Depends\)\%(-Arch\|-Indep\)\=\|\%(Pre-\)\=Depends\|Recommends\|Suggests\|Breaks\|Enhances\|Replaces\|Conflicts\|Provides\|Built-Using\|Uploaders\|X[SBC]\{0,3\}\%(Private-\)\=-[-a-zA-Z0-9]\+\): *" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=debcontrolEmail,debcontrolVariable,debcontrolComment | |
112 syn region debcontrolMultiFieldSpell matchgroup=debcontrolKey start="^Description: *" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=debcontrolEmail,debcontrolVariable,debcontrolComment,@Spell | |
7 | 113 |
114 " Associate our matches and regions with pretty colours | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
115 hi def link debcontrolKey Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
116 hi def link debcontrolField Normal |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
117 hi def link debcontrolStrictField Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
118 hi def link debcontrolDeprecatedKey Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
119 hi def link debcontrolMultiField Normal |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
120 hi def link debcontrolArchitecture Normal |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
121 hi def link debcontrolMultiArch Normal |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
122 hi def link debcontrolName Normal |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
123 hi def link debcontrolPriority Normal |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
124 hi def link debcontrolSection Normal |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
125 hi def link debcontrolPackageType Normal |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
126 hi def link debcontrolVariable Identifier |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
127 hi def link debcontrolEmail Identifier |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
128 hi def link debcontrolVcsSvn Identifier |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
129 hi def link debcontrolVcsCvs Identifier |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
130 hi def link debcontrolVcsGit Identifier |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
131 hi def link debcontrolHTTPUrl Identifier |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
132 hi def link debcontrolDmUpload Identifier |
12826 | 133 hi def link debcontrolYesNo Identifier |
134 hi def link debcontrolR3 Identifier | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
135 hi def link debcontrolComment Comment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
136 hi def link debcontrolElse Special |
7 | 137 |
13857 | 138 let b:current_syntax = 'debcontrol' |
7 | 139 |
6070
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
140 let &cpo = s:cpo_save |
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
141 unlet s:cpo_save |
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
142 |
7 | 143 " vim: ts=8 sw=2 |