0
0
mirror of https://github.com/vim/vim.git synced 2025-07-04 23:07:33 -04:00
vim/runtime/syntax/debcontrol.vim

112 lines
7.1 KiB
VimL
Raw Normal View History

2004-06-13 20:20:40 +00:00
" Vim syntax file
2010-05-14 23:24:24 +02:00
" Language: Debian control files
2006-05-02 22:08:30 +00:00
" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
" Former Maintainers: Gerfried Fuchs <alfie@ist.org>
" Wichert Akkerman <wakkerma@debian.org>
" Last Change: 2013 Oct 28
2011-06-19 05:09:16 +02:00
" URL: http://anonscm.debian.org/hg/pkg-vim/vim/raw-file/unstable/runtime/syntax/debcontrol.vim
2004-06-13 20:20:40 +00:00
" Standard syntax initialization
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
2008-06-24 22:58:06 +00:00
" Should match case except for the keys of each field
syn case match
2004-06-13 20:20:40 +00:00
" Everything that is not explicitly matched by the rules below
syn match debcontrolElse "^.*$"
" Common seperators
syn match debControlComma ", *"
syn match debControlSpace " "
" Define some common expressions we can use later on
syn match debcontrolArchitecture contained "\%(all\|linux-any\|\%(any-\)\=\%(alpha\|amd64\|arm\%(e[bl]\|hf\|64\)\=\|avr32\|hppa\|i386\|ia64\|lpia\|m32r\|m68k\|mips\%(el\)\=\|powerpc\%(spe\)\=\|ppc64\|s390x\=\|sh[34]\(eb\)\=\|sh\|sparc\%(64\)\=\)\|x32\|hurd-\%(i386\|any\)\|kfreebsd-\%(i386\|amd64\|any\)\|knetbsd-\%(i386\|any\)\|kopensolaris-\%(i386\|any\)\|netbsd-\%(alpha\|i386\|any\)\|any\)"
2011-06-19 05:09:16 +02:00
syn match debcontrolMultiArch contained "\%(no\|foreign\|allowed\|same\)"
2008-06-24 22:58:06 +00:00
syn match debcontrolName contained "[a-z0-9][a-z0-9+.-]\+"
2004-06-13 20:20:40 +00:00
syn match debcontrolPriority contained "\(extra\|important\|optional\|required\|standard\)"
2012-05-18 13:46:39 +02:00
syn match debcontrolSection contained "\v((contrib|non-free|non-US/main|non-US/contrib|non-US/non-free|restricted|universe|multiverse)/)?(admin|cli-mono|comm|database|debian-installer|debug|devel|doc|editors|education|electronics|embedded|fonts|games|gnome|gnustep|gnu-r|graphics|hamradio|haskell|httpd|interpreters|introspection|java|kde|kernel|libs|libdevel|lisp|localization|mail|math|metapackages|misc|net|news|ocaml|oldlibs|otherosfs|perl|php|python|ruby|science|shells|sound|text|tex|utils|vcs|video|web|x11|xfce|zope)"
2008-06-24 22:58:06 +00:00
syn match debcontrolPackageType contained "u\?deb"
2004-06-13 20:20:40 +00:00
syn match debcontrolVariable contained "\${.\{-}}"
2008-07-13 17:41:49 +00:00
syn match debcontrolDmUpload contained "\cyes"
2004-06-13 20:20:40 +00:00
2008-06-24 22:58:06 +00:00
" A URL (using the domain name definitions from RFC 1034 and 1738), right now
" only enforce protocol and some sanity on the server/path part;
syn match debcontrolHTTPUrl contained "\vhttps?://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$"
syn match debcontrolVcsSvn contained "\vsvn%(\+ssh)?://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$"
syn match debcontrolVcsCvs contained "\v%(\-d *)?:pserver:[^@]+\@[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?:/[^[:space:]]*%( [^[:space:]]+)?$"
syn match debcontrolVcsGit contained "\v%(git|http)://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?%(\s+-b\s+[^ ~^:?*[\\]+)?$"
2008-06-24 22:58:06 +00:00
2004-06-13 20:20:40 +00:00
" An email address
syn match debcontrolEmail "[_=[:alnum:]\.+-]\+@[[:alnum:]\./\-]\+"
syn match debcontrolEmail "<.\{-}>"
2008-06-24 22:58:06 +00:00
" #-Comments
2012-10-21 03:02:54 +02:00
syn match debcontrolComment "^#.*$" contains=@Spell
2008-06-24 22:58:06 +00:00
syn case ignore
2004-06-13 20:20:40 +00:00
" List of all legal keys
2013-03-19 11:35:58 +01:00
syn match debcontrolKey contained "^\%(Source\|Package\|Section\|Priority\|\%(XSBC-Original-\)\=Maintainer\|Uploaders\|Build-\%(Conflicts\|Depends\)\%(-Indep\)\=\|Standards-Version\|\%(Pre-\)\=Depends\|Recommends\|Suggests\|Provides\|Replaces\|Conflicts\|Enhances\|Breaks\|Essential\|Architecture\|Multi-Arch\|Description\|Bugs\|Origin\|X[SB]-Python-Version\|Homepage\|\(XS-\)\=Vcs-\(Browser\|Arch\|Bzr\|Cvs\|Darcs\|Git\|Hg\|Mtn\|Svn\)\|\%(XC-\)\=Package-Type\): *"
syn match debcontrolDeprecatedKey contained "^\%(\%(XS-\)\=DM-Upload-Allowed\): *"
2004-06-13 20:20:40 +00:00
" Fields for which we do strict syntax checking
syn region debcontrolStrictField start="^Architecture" end="$" contains=debcontrolKey,debcontrolArchitecture,debcontrolSpace oneline
2011-06-19 05:09:16 +02:00
syn region debcontrolStrictField start="^Multi-Arch" end="$" contains=debcontrolKey,debcontrolMultiArch oneline
2004-06-13 20:20:40 +00:00
syn region debcontrolStrictField start="^\(Package\|Source\)" end="$" contains=debcontrolKey,debcontrolName oneline
syn region debcontrolStrictField start="^Priority" end="$" contains=debcontrolKey,debcontrolPriority oneline
syn region debcontrolStrictField start="^Section" end="$" contains=debcontrolKey,debcontrolSection oneline
2011-06-19 05:09:16 +02:00
syn region debcontrolStrictField start="^\%(XC-\)\=Package-Type" end="$" contains=debcontrolKey,debcontrolPackageType oneline
2008-06-24 22:58:06 +00:00
syn region debcontrolStrictField start="^Homepage" end="$" contains=debcontrolKey,debcontrolHTTPUrl oneline keepend
2010-01-06 20:54:52 +01:00
syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-\%(Browser\|Arch\|Bzr\|Darcs\|Hg\)" end="$" contains=debcontrolKey,debcontrolHTTPUrl oneline keepend
syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-Svn" end="$" contains=debcontrolKey,debcontrolVcsSvn,debcontrolHTTPUrl oneline keepend
syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-Cvs" end="$" contains=debcontrolKey,debcontrolVcsCvs oneline keepend
syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-Git" end="$" contains=debcontrolKey,debcontrolVcsGit oneline keepend
2013-03-19 11:35:58 +01:00
syn region debcontrolStrictField start="^\%(XS-\)\=DM-Upload-Allowed" end="$" contains=debcontrolDeprecatedKey,debcontrolDmUpload oneline
2004-06-13 20:20:40 +00:00
" Catch-all for the other legal fields
2010-01-06 20:54:52 +01:00
syn region debcontrolField start="^\%(\%(XSBC-Original-\)\=Maintainer\|Standards-Version\|Essential\|Bugs\|Origin\|X[SB]-Python-Version\|\%(XS-\)\=Vcs-Mtn\):" end="$" contains=debcontrolKey,debcontrolVariable,debcontrolEmail oneline
2010-05-14 23:24:24 +02:00
syn region debcontrolMultiField start="^\%(Build-\%(Conflicts\|Depends\)\%(-Indep\)\=\|\%(Pre-\)\=Depends\|Recommends\|Suggests\|Provides\|Replaces\|Conflicts\|Enhances\|Breaks\|Uploaders\|Description\):" skip="^ " end="^$"me=s-1 end="^[^ #]"me=s-1 contains=debcontrolKey,debcontrolEmail,debcontrolVariable,debcontrolComment
2012-10-21 03:02:54 +02:00
syn region debcontrolMultiFieldSpell start="^\%(Description\):" skip="^ " end="^$"me=s-1 end="^[^ #]"me=s-1 contains=debcontrolKey,debcontrolEmail,debcontrolVariable,debcontrolComment,@Spell
2004-06-13 20:20:40 +00:00
" Associate our matches and regions with pretty colours
if version >= 508 || !exists("did_debcontrol_syn_inits")
if version < 508
let did_debcontrol_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink debcontrolKey Keyword
HiLink debcontrolField Normal
HiLink debcontrolStrictField Error
2013-03-19 11:35:58 +01:00
HiLink debcontrolDeprecatedKey Error
2004-06-13 20:20:40 +00:00
HiLink debcontrolMultiField Normal
HiLink debcontrolArchitecture Normal
2011-06-19 05:09:16 +02:00
HiLink debcontrolMultiArch Normal
2004-06-13 20:20:40 +00:00
HiLink debcontrolName Normal
HiLink debcontrolPriority Normal
HiLink debcontrolSection Normal
2008-06-24 22:58:06 +00:00
HiLink debcontrolPackageType Normal
2004-06-13 20:20:40 +00:00
HiLink debcontrolVariable Identifier
HiLink debcontrolEmail Identifier
2008-06-24 22:58:06 +00:00
HiLink debcontrolVcsSvn Identifier
HiLink debcontrolVcsCvs Identifier
HiLink debcontrolVcsGit Identifier
HiLink debcontrolHTTPUrl Identifier
2008-07-13 17:41:49 +00:00
HiLink debcontrolDmUpload Identifier
2008-06-24 22:58:06 +00:00
HiLink debcontrolComment Comment
2004-06-13 20:20:40 +00:00
HiLink debcontrolElse Special
delcommand HiLink
endif
let b:current_syntax = "debcontrol"
" vim: ts=8 sw=2