Mercurial > vim
annotate runtime/syntax/debcontrol.vim @ 28036:3167a59d5fc2
Added tag v8.2.4542 for changeset 9f8535cf6f1b464ba03010f80fb48b71fd02e76a
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 10 Mar 2022 23:00:04 +0100 |
parents | f0d7cb510ce3 |
children | cd68a630f0d0 |
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> | |
26708 | 6 " Last Change: 2021 Nov 26 |
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 |
22824 | 50 " Keep in sync with https://metadata.ftp-master.org/sections.822 |
51 " curl -q https://metadata.ftp-master.debian.org/sections.822 2>/dev/null| grep-dctrl -n --not -FSection -sSection / - | |
12826 | 52 let s:sections = [ |
53 \ 'admin', 'cli-mono', 'comm', 'database', 'debian-installer', 'debug' | |
54 \, 'devel', 'doc', 'editors', 'education', 'electronics', 'embedded' | |
22824 | 55 \, 'fonts', 'games', 'gnome', 'gnu-r', 'gnustep', 'golang', 'graphics' |
12826 | 56 \, 'hamradio', 'haskell', 'httpd', 'interpreters', 'introspection' |
22824 | 57 \, 'java', 'javascript', 'kde', 'kernel', 'libdevel', 'libs', 'lisp' |
58 \, 'localization', 'mail', 'math', 'metapackages', 'misc', 'net', 'news' | |
59 \, 'ocaml', 'oldlibs', 'otherosfs', 'perl', 'php', 'python', 'raku' | |
60 \, 'ruby', 'rust', 'science', 'shells', 'sound', 'tasks', 'tex', 'text' | |
12826 | 61 \, 'utils', 'vcs', 'video', 'web', 'x11', 'xfce', 'zope' |
62 \ ] | |
63 | |
64 syn keyword debcontrolMultiArch contained no foreign allowed same | |
1624 | 65 syn match debcontrolName contained "[a-z0-9][a-z0-9+.-]\+" |
12826 | 66 syn keyword debcontrolPriority contained extra important optional required standard |
22824 | 67 exe 'syn match debcontrolSection contained "\%(\%(contrib\|non-free\|non-US/main\|non-US/contrib\|non-US/non-free\|restricted\|universe\|multiverse\)/\)\=\<\%('.join(s:sections, '\|').'\)\>"' |
12826 | 68 syn keyword debcontrolPackageType contained udeb deb |
7 | 69 syn match debcontrolVariable contained "\${.\{-}}" |
12826 | 70 syn keyword debcontrolDmUpload contained yes |
71 syn keyword debcontrolYesNo contained yes no | |
72 syn match debcontrolR3 contained "\<\%(no\|binary-targets\|[[:graph:]]\+/[[:graph:]]\+\%( \+[[:graph:]]\+/[[:graph:]]\+\)*\)\>" | |
73 | |
74 unlet s:sections | |
7 | 75 |
1624 | 76 " A URL (using the domain name definitions from RFC 1034 and 1738), right now |
77 " only enforce protocol and some sanity on the server/path part; | |
78 syn match debcontrolHTTPUrl contained "\vhttps?://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$" | |
79 syn match debcontrolVcsSvn contained "\vsvn%(\+ssh)?://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$" | |
80 syn match debcontrolVcsCvs contained "\v%(\-d *)?:pserver:[^@]+\@[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?:/[^[:space:]]*%( [^[:space:]]+)?$" | |
6823 | 81 syn match debcontrolVcsGit contained "\v%(git|https?)://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?%(\s+-b\s+[^ ~^:?*[\\]+)?$" |
1624 | 82 |
7 | 83 " An email address |
84 syn match debcontrolEmail "[_=[:alnum:]\.+-]\+@[[:alnum:]\./\-]\+" | |
85 syn match debcontrolEmail "<.\{-}>" | |
86 | |
1624 | 87 " #-Comments |
3893 | 88 syn match debcontrolComment "^#.*$" contains=@Spell |
1624 | 89 |
90 syn case ignore | |
91 | |
13231 | 92 " Handle all fields from deb-src-control(5) |
7 | 93 |
26708 | 94 " Catch-all for the legal fields |
95 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 | |
96 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 | |
97 syn region debcontrolMultiFieldSpell matchgroup=debcontrolKey start="^Description: *" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=debcontrolEmail,debcontrolVariable,debcontrolComment,@Spell | |
98 | |
7 | 99 " Fields for which we do strict syntax checking |
13231 | 100 syn region debcontrolStrictField matchgroup=debcontrolKey start="^Architecture: *" end="$" contains=debcontrolArchitecture,debcontrolSpace oneline |
101 syn region debcontrolStrictField matchgroup=debcontrolKey start="^Multi-Arch: *" end="$" contains=debcontrolMultiArch oneline | |
102 syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(Package\|Source\): *" end="$" contains=debcontrolName oneline | |
103 syn region debcontrolStrictField matchgroup=debcontrolKey start="^Priority: *" end="$" contains=debcontrolPriority oneline | |
104 syn region debcontrolStrictField matchgroup=debcontrolKey start="^Section: *" end="$" contains=debcontrolSection oneline | |
105 syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XC-\)\=Package-Type: *" end="$" contains=debcontrolPackageType oneline | |
106 syn region debcontrolStrictField matchgroup=debcontrolKey start="^Homepage: *" end="$" contains=debcontrolHTTPUrl oneline keepend | |
26708 | 107 syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XS-[-a-zA-Z0-9]\+-\)\=Vcs-\%(Browser\|Arch\|Bzr\|Darcs\|Hg\): *" end="$" contains=debcontrolHTTPUrl oneline keepend |
108 syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XS-[-a-zA-Z0-9]\+-\)\=Vcs-Svn: *" end="$" contains=debcontrolVcsSvn,debcontrolHTTPUrl oneline keepend | |
109 syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XS-[-a-zA-Z0-9]\+-\)\=Vcs-Cvs: *" end="$" contains=debcontrolVcsCvs oneline keepend | |
110 syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XS-[-a-zA-Z0-9]\+-\)\=Vcs-Git: *" end="$" contains=debcontrolVcsGit oneline keepend | |
13231 | 111 syn region debcontrolStrictField matchgroup=debcontrolKey start="^Rules-Requires-Root: *" end="$" contains=debcontrolR3 oneline |
112 syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(Build-\)\=Essential: *" end="$" contains=debcontrolYesNo oneline | |
113 | |
114 syn region debcontrolStrictField matchgroup=debcontrolDeprecatedKey start="^\%(XS-\)\=DM-Upload-Allowed: *" end="$" contains=debcontrolDmUpload oneline | |
7 | 115 |
116 " 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
|
117 hi def link debcontrolKey Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
118 hi def link debcontrolField Normal |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
119 hi def link debcontrolStrictField Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
120 hi def link debcontrolDeprecatedKey Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
121 hi def link debcontrolMultiField Normal |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
122 hi def link debcontrolArchitecture Normal |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
123 hi def link debcontrolMultiArch Normal |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
124 hi def link debcontrolName Normal |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
125 hi def link debcontrolPriority Normal |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
126 hi def link debcontrolSection Normal |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
127 hi def link debcontrolPackageType Normal |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
128 hi def link debcontrolVariable Identifier |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
129 hi def link debcontrolEmail Identifier |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
130 hi def link debcontrolVcsSvn Identifier |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
131 hi def link debcontrolVcsCvs Identifier |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
132 hi def link debcontrolVcsGit Identifier |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
133 hi def link debcontrolHTTPUrl Identifier |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
134 hi def link debcontrolDmUpload Identifier |
12826 | 135 hi def link debcontrolYesNo Identifier |
136 hi def link debcontrolR3 Identifier | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
137 hi def link debcontrolComment Comment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
138 hi def link debcontrolElse Special |
7 | 139 |
13857 | 140 let b:current_syntax = 'debcontrol' |
7 | 141 |
6070
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
142 let &cpo = s:cpo_save |
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
143 unlet s:cpo_save |
32a77cc160d9
Update runtime files. Make matchparen plugin backwards compatible.
Bram Moolenaar <bram@vim.org>
parents:
5663
diff
changeset
|
144 |
7 | 145 " vim: ts=8 sw=2 |