blob: ec45605905e74e7ff7e70d24a9a16e0ab1aecb3a [file] [log] [blame]
James McCoy7b7cda62023-10-26 17:14:30 -04001" Vim syntax file
2" Language: Debian deb822-format source list file
3" Maintainer: Debian Vim Maintainers
James McCoyc7ddc9b2024-02-27 01:34:45 -05004" Last Change: 2024 Jan 30
James McCoy7b7cda62023-10-26 17:14:30 -04005" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/deb822sources.vim
6
7" Standard syntax initialization
8if exists('b:current_syntax')
9 finish
10endif
11
12" case insensitive
13syn case ignore
14
James McCoyc7ddc9b2024-02-27 01:34:45 -050015" A bunch of useful keywords
16syn match deb822sourcesType /\<\(deb-src\|deb\)\ */ contained
17syn match deb822sourcesFreeComponent /\<\(main\|universe\)\> */ contained
18syn match deb822sourcesNonFreeComponent /\<\(contrib\|non-free-firmware\|non-free\|restricted\|multiverse\)\> */ contained
19
James McCoy7b7cda62023-10-26 17:14:30 -040020" Comments are matched from the first character of a line to the end-of-line
21syn region deb822sourcesComment start="^#" end="$"
22
James McCoy7b7cda62023-10-26 17:14:30 -040023" Include Debian versioning information
24runtime! syntax/shared/debversions.vim
25
James McCoyc7ddc9b2024-02-27 01:34:45 -050026exe 'syn match deb822sourcesSupportedSuites contained + *\([[:alnum:]_./]*\)\<\('. join(g:debSharedSupportedVersions, '\|'). '\)\>\([-[:alnum:]_./]*\) *+'
27exe 'syn match deb822sourcesUnsupportedSuites contained + *\([[:alnum:]_./]*\)\<\('. join(g:debSharedUnsupportedVersions, '\|'). '\)\>\([-[:alnum:]_./]*\) *+'
James McCoy7b7cda62023-10-26 17:14:30 -040028
29unlet g:debSharedSupportedVersions
30unlet g:debSharedUnsupportedVersions
31
32syn region deb822sourcesSuites start="\(^Suites: *\)\@<=" end="$" contains=deb822sourcesSupportedSuites,deb822sourcesUnsupportedSuites oneline
33
34syn keyword deb822sourcesForce contained force
35syn keyword deb822sourcesYesNo contained yes no
36
37" Match uri's
38syn match deb822sourcesUri '\(https\?://\|ftp://\|[rs]sh://\|debtorrent://\|\(cdrom\|copy\|file\):\)[^' <>"]\+'
39
James McCoyc7ddc9b2024-02-27 01:34:45 -050040syn region deb822sourcesStrictField matchgroup=deb822sourcesEntryField start="^\%(Types\|URIs\|Suites\|Components\): *" end="$" contains=deb822sourcesType,deb822sourcesUri,deb822sourcesSupportedSuites,deb822sourcesUnsupportedSuites,deb822sourcesFreeComponent,deb822sourcesNonFreeComponent oneline
41syn region deb822sourcesField matchgroup=deb822sourcesOptionField start="^\%(Signed-By\|Check-Valid-Until\|Valid-Until-Min\|Valid-Until-Max\|Date-Max-Future\|InRelease-Path\): *" end="$" oneline
42syn region deb822sourcesField matchgroup=deb822sourcesMultiValueOptionField start="^\%(Architectures\|Languages\|Targets\)\%(-Add\|-Remove\)\?: *" end="$" oneline
Kentaro Hayashib8076f92024-06-10 18:21:26 +020043syn region deb822sourcesStrictField matchgroup=deb822sourcesBooleanOptionField start="^\%(PDiffs\|Allow-Insecure\|Allow-Weak\|Allow-Downgrade-To-Insecure\|Trusted\|Check-Date\|Enabled\): *" end="$" contains=deb822sourcesYesNo oneline
James McCoy7b7cda62023-10-26 17:14:30 -040044syn region deb822sourcesStrictField matchgroup=deb822sourcesForceBooleanOptionField start="^\%(By-Hash\): *" end="$" contains=deb822sourcesForce,deb822sourcesYesNo oneline
45
James McCoyc7ddc9b2024-02-27 01:34:45 -050046hi def link deb822sourcesField Default
James McCoy7b7cda62023-10-26 17:14:30 -040047hi def link deb822sourcesComment Comment
48hi def link deb822sourcesEntryField Keyword
49hi def link deb822sourcesOptionField Special
50hi def link deb822sourcesMultiValueOptionField Special
51hi def link deb822sourcesBooleanOptionField Special
52hi def link deb822sourcesForceBooleanOptionField Special
53hi def link deb822sourcesStrictField Error
54hi def link deb822sourcesType Identifier
55hi def link deb822sourcesFreeComponent Identifier
56hi def link deb822sourcesNonFreeComponent Identifier
57hi def link deb822sourcesForce Identifier
58hi def link deb822sourcesYesNo Identifier
59hi def link deb822sourcesUri Constant
60hi def link deb822sourcesSupportedSuites Type
61hi def link deb822sourcesUnsupportedSuites WarningMsg
62
63let b:current_syntax = 'deb822sources'