1" Vim syntax file
2" Language:     Debian sources.list
3" Maintainer:   Debian Vim Maintainers
4" Former Maintainer: Matthijs Mohlmann <[email protected]>
5" Last Change: 2019 Oct 18
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      \ 'wheezy', 'jessie', 'stretch', 'buster', 'bullseye', 'bookworm',
27      \ 'sid', 'rc-buggy',
28      \
29      \ 'trusty', 'xenial', 'bionic', 'disco', 'eoan', 'focal', 'devel'
30      \ ]
31let s:unsupported = [
32      \ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato',
33      \ 'woody', 'sarge', 'etch', 'lenny', 'squeeze',
34      \
35      \ 'warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty',
36      \ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid',
37      \ 'maverick', 'natty', 'oneiric', 'precise', 'quantal', 'raring', 'saucy',
38      \ 'utopic', 'vivid', 'wily', 'yakkety', 'zesty', 'artful', 'cosmic'
39      \ ]
40let &cpo=s:cpo
41
42" Match uri's
43syn match debsourcesUri            '\(https\?://\|ftp://\|[rs]sh://\|debtorrent://\|\(cdrom\|copy\|file\):\)[^' 	<>"]\+'
44exe 'syn match debsourcesDistrKeyword   +\([[:alnum:]_./]*\)\<\('. join(s:supported, '\|'). '\)\>\([-[:alnum:]_./]*\)+'
45exe 'syn match debsourcesUnsupportedDistrKeyword +\([[:alnum:]_./]*\)\<\('. join(s:unsupported, '\|') .'\)\>\([-[:alnum:]_./]*\)+'
46
47" Associate our matches and regions with pretty colours
48hi def link debsourcesLine                    Error
49hi def link debsourcesKeyword                 Statement
50hi def link debsourcesDistrKeyword            Type
51hi def link debsourcesUnsupportedDistrKeyword WarningMsg
52hi def link debsourcesComment                 Comment
53hi def link debsourcesUri                     Constant
54
55let b:current_syntax = 'debsources'
56