1" Vim syntax file
2" Language:     Debian sources.list
3" Maintainer:   Debian Vim Maintainers
4" Former Maintainer: Matthijs Mohlmann <[email protected]>
5" Last Change: 2021 Oct 19
6" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debsources.vim
7
8" Standard syntax initialization
9if exists('b:current_syntax')
10  finish
11endif
12
13" case sensitive
14syn case match
15
16" A bunch of useful keywords
17syn match debsourcesKeyword        /\(deb-src\|deb\|main\|contrib\|non-free\|restricted\|universe\|multiverse\)/
18
19" Match comments
20syn match debsourcesComment        /#.*/  contains=@Spell
21
22let s:cpo = &cpo
23set cpo-=C
24let s:supported = [
25      \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental',
26      \ 'jessie', 'stretch', 'buster', 'bullseye', 'bookworm',
27      \ 'trixie', 'sid', 'rc-buggy',
28      \
29      \ 'trusty', 'xenial', 'bionic', 'focal', 'hirsute', 'impish', 'jammy',
30      \ 'devel'
31      \ ]
32let s:unsupported = [
33      \ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato',
34      \ 'woody', 'sarge', 'etch', 'lenny', 'squeeze', 'wheezy',
35      \
36      \ 'warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty',
37      \ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid',
38      \ 'maverick', 'natty', 'oneiric', 'precise', 'quantal', 'raring', 'saucy',
39      \ 'utopic', 'vivid', 'wily', 'yakkety', 'zesty', 'artful', 'cosmic',
40      \ 'disco', 'eoan', 'groovy'
41      \ ]
42let &cpo=s:cpo
43
44" Match uri's
45syn match debsourcesUri            '\(https\?://\|ftp://\|[rs]sh://\|debtorrent://\|\(cdrom\|copy\|file\):\)[^' 	<>"]\+'
46exe 'syn match debsourcesDistrKeyword   +\([[:alnum:]_./]*\)\<\('. join(s:supported, '\|'). '\)\>\([-[:alnum:]_./]*\)+'
47exe 'syn match debsourcesUnsupportedDistrKeyword +\([[:alnum:]_./]*\)\<\('. join(s:unsupported, '\|') .'\)\>\([-[:alnum:]_./]*\)+'
48
49" Associate our matches and regions with pretty colours
50hi def link debsourcesLine                    Error
51hi def link debsourcesKeyword                 Statement
52hi def link debsourcesDistrKeyword            Type
53hi def link debsourcesUnsupportedDistrKeyword WarningMsg
54hi def link debsourcesComment                 Comment
55hi def link debsourcesUri                     Constant
56
57let b:current_syntax = 'debsources'
58