blob: 5dc1b5f6f5230adf7e4b9df876d6b9d909af83ce [file] [log] [blame]
James McCoye9d331d2025-07-06 18:00:28 +02001" Vim syntax file
2" Language: Debian autopkgtest control files
3" Maintainer: Debian Vim Maintainers
4" Last Change: 2025 Jul 05
5" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/autopkgtest.vim
6"
7" Specification of the autopkgtest format is available at:
8" https://www.debian.org/doc/debian-policy/autopkgtest.txt
9
10" Standard syntax initialization
11if exists('b:current_syntax')
12 finish
13endif
14
15let s:cpo_save = &cpo
16set cpo&vim
17
18" Must call this first, because it will clear other settings
19syn sync clear
20syn sync match autopkgtestSync grouphere NONE '^$'
21
22" Should match case except for the keys of each field
23syn case match
24
25syn iskeyword @,48-57,-
26
27" #-Comments
28syn match autopkgtestComment "#.*" contains=@Spell
29
30syn match autopkgtestTests contained "[a-z0-9][a-z0-9+.-]\+\%(,\=\s*[a-z0-9][a-z0-9+.-]\+\)*,\="
31syn match autopkgtestArbitrary contained "[^#]*"
32syn keyword autopkgtestRestrictions contained
33 \ allow-stderr
34 \ breaks-testbe
35 \ build-neede
36 \ flaky
37 \ hint-testsuite-trigger
38 \ isolation-container
39 \ isolation-machine
40 \ needs-internet
41 \ needs-reboot
42 \ needs-root
43 \ needs-sudo
44 \ rw-build-tree
45 \ skip-foreign-architecture
46 \ skip-not-installable
47 \ skippable
48 \ superficial
49syn keyword autopkgtestDeprecatedRestrictions contained needs-recommends
50syn match autopkgtestFeatures contained 'test-name=[^, ]*\%([, ]*[^, #]\)*,\='
51syn match autopkgtestDepends contained '\%(@builddeps@\|@recommends@\|@\)'
52
53runtime! syntax/shared/debarchitectures.vim
54
55syn keyword autopkgtestArchitecture contained any
56exe 'syn keyword autopkgtestArchitecture contained '. join(g:debArchitectureKernelAnyArch)
57exe 'syn keyword autopkgtestArchitecture contained '. join(g:debArchitectureAnyKernelArch)
58exe 'syn keyword autopkgtestArchitecture contained '. join(g:debArchitectureArchs)
59
60syn case ignore
61
62" Catch-all for the legal fields
63syn region autopkgtestMultiField matchgroup=autopkgtestKey start="^Tests: *" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=autopkgtestTests,autopkgtestComment
64syn region autopkgtestMultiField matchgroup=autopkgtestKey start="^Restrictions: *" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=autopkgtestRestrictions,autopkgtestDeprecatedRestrictions,autopkgtestComment
65syn region autopkgtestMultiField matchgroup=autopkgtestKey start="^Features: *" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=autopkgtestFeatures,autopkgtestComment
66syn region autopkgtestMultiField matchgroup=autopkgtestKey start="^Depends: *" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=autopkgtestDepends,autopkgtestComment
67syn region autopkgtestMultiField matchgroup=autopkgtestKey start="^Classes: *" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=autopkgtestComment
68syn region autopkgtestMultiField matchgroup=autopkgtestKey start="^Architecture: *" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=autopkgtestArchitecture,autopkgtestComment
69
70" Fields for which we do strict syntax checking
71syn region autopkgtestStrictField matchgroup=autopkgtestKey start="^Test-Command: *" end="$" end='#'me=s-1 contains=autopkgtestArbitrary,autopkgtestComment oneline
72syn region autopkgtestStrictField matchgroup=autopkgtestKey start="^Tests-Directory: *" end="$" end='#'me=s-1 contains=autopkgtestArbitrary,autopkgtestComment oneline
73
74syn match autopkgtestError '^\%(\%(Architecture\|Classes\|Depends\|Features\|Restrictions\|Test-Command\|Tests-Directory\|Tests\)\@![^ #]*:\)'
75
76" Associate our matches and regions with pretty colours
77hi def link autopkgtestKey Keyword
78hi def link autopkgtestRestrictions Identifier
79hi def link autopkgtestFeatures Keyword
80hi def link autopkgtestDepends Identifier
81hi def link autopkgtestArchitecture Identifier
82hi def link autopkgtestStrictField Error
83hi def link autopkgtestDeprecatedRestrictions Error
84hi def link autopkgtestMultiField Normal
85hi def link autopkgtestArbitrary Normal
86hi def link autopkgtestTests Normal
87hi def link autopkgtestComment Comment
88hi def link autopkgtestError Error
89
90let b:current_syntax = 'autopkgtest'
91
92let &cpo = s:cpo_save
93unlet s:cpo_save
94
95" vim: ts=8 sw=2