Rename pmconflict_t to alpm_conflict_t
[pacman-ng.git] / contrib / PKGBUILD.vim
blobf627a5e64b6cd7eee8c10fcbc00675a368ae3314
1 " Vim syntax file
2 " Language:     PKGBUILD
3 " Maintainer:   Alessio 'mOLOk' Bolognino <themolok at gmail.com>
4 " Last Change:  2007/05/08
5 " Version Info: PKGBUILD-0.2 (colorphobic)
7 " For version 5.x: Clear all syntax items
8 " For version 6.x: Quit when a syntax file was already loaded
9 if version < 600
10         syntax clear
11 elseif exists("b:current_syntax")
12         finish
13 endif
15 let b:main_syntax = "sh"
16 runtime! syntax/sh.vim
18 " case on
19 syn case match
21 " pkgname
22 " FIXME if '=' is in pkgname/pkgver, it highlights whole string, not just '='
23 syn keyword pb_k_pkgname pkgname contained
24 syn match pbValidPkgname /\([[:alnum:]]\|+\|-\|_\){,32}/ contained contains=pbIllegalPkgname
25 syn match pbIllegalPkgname /[[:upper:]]\|[^[:alnum:]-+_=]\|=.*=\|=['"]\?.\{33,\}['"]\?/ contained
26 syn match pbPkgnameGroup /^pkgname=.*/ contains=pbIllegalPkgname,pb_k_pkgname,shDoubleQuote,shSingleQuote
28 " pkgbase
29 " FIXME if '=' is in pkgbase/pkgname/pkgver, it highlights whole string, not just '='
30 syn keyword pb_k_pkgbase pkgbase contained
31 syn match pbValidPkgbase /\([[:alnum:]]\|+\|-\|_\){,32}/ contained contains=pbIllegalPkgbase
32 syn match pbIllegalPkgbase /[[:upper:]]\|[^[:alnum:]-+_=]\|=.*=\|=['"]\?.\{33,\}['"]\?/ contained
33 syn match pbPkgbaseGroup /^pkgbase=.*/ contains=pbIllegalPkgbase,pb_k_pkgbase,shDoubleQuote,shSingleQuote
35 " pkgver
36 syn keyword pb_k_pkgver pkgver contained
37 syn match pbValidPkgver /\([[:alnum:]]\|\.\|+\|_\)/ contained contains=pbIllegalPkgver
38 syn match pbIllegalPkgver /[^[:alnum:]+=\.\_]\|=.*=/ contained
39 syn match pbPkgverGroup /^pkgver=.*/ contains=pbIllegalPkgver,pbValidPkgver,pb_k_pkgver,shDoubleQuote,shSingleQuote
41 " pkgrel
42 syn keyword pb_k_pkgrel pkgrel contained
43 syn match pbValidPkgrel /[[:digit:]]*/ contained contains=pbIllegalPkgrel
44 syn match pbIllegalPkgrel /[^[:digit:]=]\|=.*=/ contained
45 syn match pbPkgrelGroup /^pkgrel=.*/ contains=pbIllegalPkgrel,pbValidPkgrel,pb_k_pkgrel,shDoubleQuote,shSingleQuote
47 " pkgdesc
48 syn keyword pb_k_desc pkgdesc contained
49 " 90 chars: 80 for description, 8 for pkgdesc and 2 for ''
50 syn match pbIllegalPkgdesc /.\{90,}\|=['"]\?.*['" ]\+[iI][sS] [aA]/ contained contains=pbPkgdescSign
51 syn match pbValidPkgdesc /[^='"]\.\{,80}/ contained contains=pbIllegalPkgdesc
52 syn match pbPkgdescGroup /^pkgdesc=.*/ contains=pbIllegalPkgdesc,pb_k_desc,pbValidPkgdesc,shDoubleQuote,shSingleQuote
53 syn match pbPkgdescSign /[='"]/ contained
55 " epoch
56 syn keyword pb_k_epoch epoch contained
57 syn match pbValidEpoch /[[:digit:]]*/ contained contains=pbIllegalEpoch
58 syn match pbIllegalEpoch /[^[:digit:]=]\|=.*=/ contained
59 syn match pbEpochGroup /^epoch=.*/ contains=pbIllegalEpoch,pbValidEpoch,pb_k_epoch,shDoubleQuote,shSingleQuote
61 " url
62 syn keyword pb_k_url url contained
63 syn match pbValidUrl /['"]*\(https\|http\|ftp\)\:\/.*\.\+.*/ contained
65 syn match pbIllegalUrl /[^=]/ contained contains=pbValidUrl
66 syn match pbUrlGroup /^url=.*/ contains=pbValidUrl,pb_k_url,pbIllegalUrl,shDoubleQuote,shSingleQuote
68 " license
69 syn keyword pb_k_license license contained
70 " echo $(pacman -Ql licenses | grep '/usr/share/licenses/common/' | cut -d'/' -f6 | sort -u)
71 syn keyword pbLicense  APACHE CCPL CDDL CPL EPL FDL FDL1.2 FDL1.3 GPL GPL2 GPL3 LGPL LGPL2.1 LGPL3 LPPL MPL PerlArtistic PHP PSF RALINK RUBY ZPL contained
72 " special cases from http://wiki.archlinux.org/index.php/Arch_Packaging_Standards
73 syn keyword pbLicenseSpecial  BSD MIT ZLIB Python contained
74 syn match pbLicenseCustom /custom\(:[[:alnum:]]*\)*/ contained
75 syn match pbIllegalLicense /[^='"() ]/ contained contains=pbLicenseCustom,pbLicenseSpecial,pbLicense
76 syn region pbLicenseGroup start=/^license=(/ end=/)/ contains=pb_k_license,pbLicenseCustom,pbLicenseSpecial,pbLicense,pbIllegalLicense
78 " backup
79 syn keyword pb_k_backup backup contained
80 syn match pbValidBackup   /\.\?[[:alpha:]]*\/[[:alnum:]\{\}+._$-]*]*/ contained
81 syn region pbBackupGroup start=/^backup=(/ end=/)/ contains=pb_k_backup,pbValidBackup,shDoubleQuote,shSingleQuote
83 " arch
84 syn keyword pb_k_arch arch contained
85 syn keyword pbArch i686 x86_64 ppc any contained
86 syn match pbIllegalArch /[^='"() ]/ contained contains=pbArch
87 syn region pbArchGroup start=/^arch=(/ end=/)/ contains=pb_k_arch,pbArch,pbIllegalArch
89 " groups
90 syn keyword pb_k_groups groups contained
91 syn match pbValidGroups /\([[:alnum:]]\|+\|-\|_\)*/ contained
92 syn region pbGroupsGroup start=/^groups=(/ end=/)/ contains=pb_k_groups,pbValidGroups,shDoubleQuote,shSingleQuote
94 " depends
95 syn keyword pb_k_depends depends contained
96 syn match pbValidDepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
97 syn region pbDependsGroup start=/^depends=(/ end=/)/ contains=pb_k_depends,pbValidDepends,shDoubleQuote,shSingleQuote
99 " makedepends
100 syn keyword pb_k_makedepends makedepends contained
101 syn match pbValidMakedepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
102 syn region pbMakedependsGroup start=/^makedepends=(/ end=/)/ contains=pb_k_makedepends,pbValidMakedepends,shDoubleQuote,shSingleQuote
104 " optdepends
105 syn keyword pb_k_optdepends optdepends contained
106 syn match pbValidOptdepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
107 syn region pbOptdependsGroup start=/^optdepends=(/ end=/)/ contains=pb_k_optdepends,pbValidOptdepends,shDoubleQuote,shSingleQuote
109 " conflicts
110 syn keyword pb_k_conflicts conflicts contained
111 syn match pbValidConflicts /\([[:alnum:]]\|+\|-\|_\)*/ contained
112 syn region pbConflictsGroup start=/^conflicts=(/ end=/)/ contains=pb_k_conflicts,pbValidConflicts,shDoubleQuote,shSingleQuote
114 " provides
115 syn keyword pb_k_provides provides contained
116 syn match pbValidProvides /\([[:alnum:]]\|+\|-\|_\)*/ contained
117 syn region pbProvidesGroup start=/^provides=(/ end=/)/ contains=pb_k_provides,pbValidProvides,shDoubleQuote,shSingleQuote
119 " replaces
120 syn keyword pb_k_replaces replaces contained
121 syn match pbValidReplaces /\([[:alnum:]]\|+\|-\|_\)*/ contained
122 syn region pbReplacesGroup start=/^replaces=(/  end=/)/ contains=pb_k_replaces,pbValidReplaces,shDoubleQuote,shSingleQuote
124 " install
125 " XXX remove install from bashStatement, fix strange bug
126 syn clear bashStatement
127 syn keyword bashStatement chmod clear complete du egrep expr fgrep find gnufind gnugrep grep less ls mkdir mv rm rmdir rpm sed sleep sort strip tail touch
129 syn keyword pb_k_install install contained
130 syn match pbValidInstall /\([[:alnum:]]\|\$\|+\|-\|_\)*\.install/ contained
131 syn match pbIllegalInstall /[^=]/ contained contains=pbValidInstall
132 syn match pbInstallGroup /^install=.*/ contains=pb_k_install,pbValidInstall,pbIllegalInstall,shDeref,shDoubleQuote,shSingleQuote
134 " changelog
135 syn keyword pb_k_changelog changelog contained
136 syn match pbValidChangelog /\([[:alnum:]]\|\$\|+\|-\|_\)*/ contained
137 syn match pbIllegalChangelog /[^=]/ contained contains=pbValidChangelog
138 syn match pbChangelogGroup /^changelog=.*/ contains=pb_k_changelog,pbValidChangelog,pbIllegalChangelog,shDeref,shDoubleQuote,shSingleQuote
140 " source:
141 " XXX remove source from shStatement, fix strange bug
142 syn clear shStatement
143 syn keyword shStatement xxx wait getopts return autoload whence printf true popd nohup enable r trap readonly fc fg kill ulimit umask disown stop pushd read history logout times local exit test pwd time eval integer suspend dirs shopt hash false newgrp bg print jobs continue functions exec help cd break unalias chdir type shift builtin let bind
145 syn keyword pb_k_source source contained
146 syn match pbIllegalSource /\(http\|ftp\|https\).*\.\+\(dl\|download.\?\)\.\(sourceforge\|sf\).net/
147 syn region pbSourceGroup  start=/^source=(/ end=/)/ contains=pb_k_source,pbIllegalSource,shNumber,shDoubleQuote,shSingleQuote,pbDerefEmulation
148 syn match pbDerefEmulation /\$[{]\?[[:alnum:]_]*[}]\?/ contained
149 hi def link pbDerefEmulation PreProc
151 " md5sums
152 syn keyword pb_k_md5sums md5sums contained
153 syn match pbIllegalMd5sums /[^='"()\/ ]/ contained contains=pbValidMd5sums
154 syn match pbValidMd5sums /\x\{32\}/ contained
155 syn region pbMd5sumsGroup start=/^md5sums/ end=/)/ contains=pb_k_md5sums,pbMd5Quotes,pbMd5Hash,pbIllegalMd5sums keepend
156 syn match pbMd5Quotes /'.*'\|".*"/ contained contains=pbMd5Hash,pbIllegalMd5sums
157 syn match pbMd5Hash /\x\+/ contained contains=pbValidMd5sums
158 hi def link pbMd5Quotes Keyword
159 hi def link pbMd5Hash Error
160 hi def link pbValidMd5sums  Number
162 " sha1sums
163 syn keyword pb_k_sha1sums sha1sums contained
164 syn match pbIllegalSha1sums /[^='"()\/ ]/ contained contains=pbValidSha1sums
165 syn match pbValidSha1sums /\x\{40\}/ contained
166 syn region pbSha1sumsGroup start=/^sha1sums/ end=/)/ contains=pb_k_sha1sums,pbSha1Quotes,pbSha1Hash,pbIllegalSha1sums keepend
167 syn match pbSha1Quotes /'.*'\|".*"/ contained contains=pbSha1Hash,pbIllegalSha1sums
168 syn match pbSha1Hash /\x\+/ contained contains=pbValidSha1sums
169 hi def link pbSha1Quotes Keyword
170 hi def link pbSha1Hash Error
171 hi def link pbValidSha1sums  Number
173 " options
174 syn keyword pb_k_options options contained
175 syn match pbOptions /\(no\)\?\(strip\|docs\|libtool\|emptydirs\|zipman\|ccache\|distcc\|makeflags\|buildflags\)/ contained
176 syn match   pbOptionsNeg     /\!/ contained
177 syn match   pbOptionsDeprec  /no/ contained
178 syn region pbOptionsGroup start=/^options=(/ end=/)/ contains=pb_k_options,pbOptions,pbOptionsNeg,pbOptionsDeprec,pbIllegalOption,shDoubleQuote,shSingleQuote
179 syn match pbIllegalOption /[^!"'()= ]/ contained contains=pbOptionsDeprec,pbOptions
181 " noextract
182 syn match pbNoextract /[[:alnum:]+._${}-]\+/ contained
183 syn keyword pb_k_noextract noextract  contained
184 syn region pbNoextractGroup  start=/^noextract=(/ end=/)/ contains=pb_k_noextract,pbNoextract,shDoubleQuote,shSingleQuote
186 " comments
187 syn keyword    pb_k_maintainer Maintainer Contributor contained
188 syn match      pbMaintainerGroup /Maintainer.*/ contains=pbMaintainer contained
190 syn match pbDate /[0-9]\{4}\/[0-9]\{2}\/[0-9]\{2}/ contained
192 syn cluster    pbCommentGroup   contains=pbTodo,pb_k_maintainer,pbMaintainerGroup,pbDate
193 syn keyword    pbTodo   contained       COMBAK FIXME TODO XXX
194 syn match      pbComment        "^#.*$" contains=@pbCommentGroup
195 syn match      pbComment        "[^0-9]#.*$"    contains=@pbCommentGroup
197 " quotes are handled by sh.vim
199 hi def link pbComment Comment
200 hi def link pbTodo Todo
202 hi def link pbIllegalPkgname Error
203 hi def link pb_k_pkgname pbKeywords
205 hi def link pbIllegalPkgbase Error
206 hi def link pb_k_pkgbase pbKeywords
208 hi def link pbIllegalPkgver Error
209 hi def link pb_k_pkgver pbKeywords
211 hi def link pbIllegalPkgrel Error
212 hi def link pb_k_pkgrel pbKeywords
214 hi def link pbIllegalPkgdesc Error
215 hi def link pb_k_desc pbKeywords
217 hi def link pbIllegalUrl Error
218 hi def link pb_k_url pbKeywords
220 hi def link pb_k_license pbKeywords
221 hi def link pbIllegalLicense Error
223 hi def link pb_k_backup pbKeywords
225 hi def link pb_k_arch pbKeywords
226 hi def link pbIllegalArch Error
228 hi def link pb_k_groups pbKeywords
229 hi def link pb_k_makedepends pbKeywords
230 hi def link pb_k_optdepends pbKeywords
231 hi def link pb_k_depends pbKeywords
232 hi def link pb_k_replaces pbKeywords
233 hi def link pb_k_conflicts pbKeywords
234 hi def link pb_k_provides pbKeywords
236 hi def link pbIllegalInstall Error
237 hi def link pb_k_install pbKeywords
239 hi def link pbIllegalChangelog Error
240 hi def link pb_k_changelog pbKeywords
242 hi def link pb_k_source pbKeywords
243 hi def link pbIllegalSource Error
245 hi def link pb_k_md5sums pbKeywords
246 hi def link pbIllegalMd5sums Error
248 hi def link pb_k_sha1sums pbKeywords
249 hi def link pbIllegalSha1sums Error
251 hi def link pb_k_options pbKeywords
252 hi def link pbOptionsDeprec Todo
253 hi def link pbIllegalOption Error
255 hi def link pb_k_noextract pbKeywords
256 hi def link pbNoextract Normal
258 hi def link pb_k_maintainer pbKeywords
260 hi def link pbKeywords Keyword
262 hi def link pbDate Special
264 "syntax include @SHELL syntax/sh.vim
265 "syntax region BUILD start=/^build()/ end=/^}/ contains=@SHELL
266 "let b:current_syntax = "PKGBUILD"
268 " vim: ft=vim