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