James McCoy | e9d331d | 2025-07-06 18:00:28 +0200 | [diff] [blame] | 1 | " 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 |
| 11 | if exists('b:current_syntax') |
| 12 | finish |
| 13 | endif |
| 14 | |
| 15 | let s:cpo_save = &cpo |
| 16 | set cpo&vim |
| 17 | |
| 18 | " Must call this first, because it will clear other settings |
| 19 | syn sync clear |
| 20 | syn sync match autopkgtestSync grouphere NONE '^$' |
| 21 | |
| 22 | " Should match case except for the keys of each field |
| 23 | syn case match |
| 24 | |
| 25 | syn iskeyword @,48-57,- |
| 26 | |
| 27 | " #-Comments |
| 28 | syn match autopkgtestComment "#.*" contains=@Spell |
| 29 | |
| 30 | syn match autopkgtestTests contained "[a-z0-9][a-z0-9+.-]\+\%(,\=\s*[a-z0-9][a-z0-9+.-]\+\)*,\=" |
| 31 | syn match autopkgtestArbitrary contained "[^#]*" |
| 32 | syn 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 |
| 49 | syn keyword autopkgtestDeprecatedRestrictions contained needs-recommends |
| 50 | syn match autopkgtestFeatures contained 'test-name=[^, ]*\%([, ]*[^, #]\)*,\=' |
| 51 | syn match autopkgtestDepends contained '\%(@builddeps@\|@recommends@\|@\)' |
| 52 | |
| 53 | runtime! syntax/shared/debarchitectures.vim |
| 54 | |
| 55 | syn keyword autopkgtestArchitecture contained any |
| 56 | exe 'syn keyword autopkgtestArchitecture contained '. join(g:debArchitectureKernelAnyArch) |
| 57 | exe 'syn keyword autopkgtestArchitecture contained '. join(g:debArchitectureAnyKernelArch) |
| 58 | exe 'syn keyword autopkgtestArchitecture contained '. join(g:debArchitectureArchs) |
| 59 | |
| 60 | syn case ignore |
| 61 | |
| 62 | " Catch-all for the legal fields |
| 63 | syn region autopkgtestMultiField matchgroup=autopkgtestKey start="^Tests: *" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=autopkgtestTests,autopkgtestComment |
| 64 | syn region autopkgtestMultiField matchgroup=autopkgtestKey start="^Restrictions: *" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=autopkgtestRestrictions,autopkgtestDeprecatedRestrictions,autopkgtestComment |
| 65 | syn region autopkgtestMultiField matchgroup=autopkgtestKey start="^Features: *" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=autopkgtestFeatures,autopkgtestComment |
| 66 | syn region autopkgtestMultiField matchgroup=autopkgtestKey start="^Depends: *" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=autopkgtestDepends,autopkgtestComment |
| 67 | syn region autopkgtestMultiField matchgroup=autopkgtestKey start="^Classes: *" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=autopkgtestComment |
| 68 | syn 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 |
| 71 | syn region autopkgtestStrictField matchgroup=autopkgtestKey start="^Test-Command: *" end="$" end='#'me=s-1 contains=autopkgtestArbitrary,autopkgtestComment oneline |
| 72 | syn region autopkgtestStrictField matchgroup=autopkgtestKey start="^Tests-Directory: *" end="$" end='#'me=s-1 contains=autopkgtestArbitrary,autopkgtestComment oneline |
| 73 | |
| 74 | syn match autopkgtestError '^\%(\%(Architecture\|Classes\|Depends\|Features\|Restrictions\|Test-Command\|Tests-Directory\|Tests\)\@![^ #]*:\)' |
| 75 | |
| 76 | " Associate our matches and regions with pretty colours |
| 77 | hi def link autopkgtestKey Keyword |
| 78 | hi def link autopkgtestRestrictions Identifier |
| 79 | hi def link autopkgtestFeatures Keyword |
| 80 | hi def link autopkgtestDepends Identifier |
| 81 | hi def link autopkgtestArchitecture Identifier |
| 82 | hi def link autopkgtestStrictField Error |
| 83 | hi def link autopkgtestDeprecatedRestrictions Error |
| 84 | hi def link autopkgtestMultiField Normal |
| 85 | hi def link autopkgtestArbitrary Normal |
| 86 | hi def link autopkgtestTests Normal |
| 87 | hi def link autopkgtestComment Comment |
| 88 | hi def link autopkgtestError Error |
| 89 | |
| 90 | let b:current_syntax = 'autopkgtest' |
| 91 | |
| 92 | let &cpo = s:cpo_save |
| 93 | unlet s:cpo_save |
| 94 | |
| 95 | " vim: ts=8 sw=2 |