lib/dload: prevent possible NULL dereference
[pacman-ng.git] / contrib / PKGBUILD.vim
blob1814c224d6516b0b374641b02c9dbc6762b4b773
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 let b:is_bash = 1
17 runtime! syntax/sh.vim
19 " case on
20 syn case match
22 " pkgname
23 " FIXME if '=' is in pkgname/pkgver, it highlights whole string, not just '='
24 syn keyword pb_k_pkgname pkgname contained
25 syn match pbValidPkgname /\([[:alnum:]]\|+\|-\|_\){,32}/ contained contains=pbIllegalPkgname
26 syn match pbIllegalPkgname /[[:upper:]]\|[^[:alnum:]-+_=]\|=.*=\|=['"]\?.\{33,\}['"]\?/ contained
27 syn match pbPkgnameGroup /^pkgname=.*/ contains=pbIllegalPkgname,pb_k_pkgname,shDoubleQuote,shSingleQuote
29 " pkgbase
30 " FIXME if '=' is in pkgbase/pkgname/pkgver, it highlights whole string, not just '='
31 syn keyword pb_k_pkgbase pkgbase contained
32 syn match pbValidPkgbase /\([[:alnum:]]\|+\|-\|_\){,32}/ contained contains=pbIllegalPkgbase
33 syn match pbIllegalPkgbase /[[:upper:]]\|[^[:alnum:]-+_=]\|=.*=\|=['"]\?.\{33,\}['"]\?/ contained
34 syn match pbPkgbaseGroup /^pkgbase=.*/ contains=pbIllegalPkgbase,pb_k_pkgbase,shDoubleQuote,shSingleQuote
36 " pkgver
37 syn keyword pb_k_pkgver pkgver contained
38 syn match pbValidPkgver /\([[:alnum:]]\|\.\|+\|_\)/ contained contains=pbIllegalPkgver
39 syn match pbIllegalPkgver /[^[:alnum:]+=\.\_]\|=.*=/ contained
40 syn match pbPkgverGroup /^pkgver=.*/ contains=pbIllegalPkgver,pbValidPkgver,pb_k_pkgver,shDoubleQuote,shSingleQuote
42 " pkgrel
43 syn keyword pb_k_pkgrel pkgrel contained
44 syn match pbValidPkgrel /[[:digit:]]*/ contained contains=pbIllegalPkgrel
45 syn match pbIllegalPkgrel /[^[:digit:]=]\|=.*=/ contained
46 syn match pbPkgrelGroup /^pkgrel=.*/ contains=pbIllegalPkgrel,pbValidPkgrel,pb_k_pkgrel,shDoubleQuote,shSingleQuote
48 " pkgdesc
49 syn keyword pb_k_desc pkgdesc contained
50 " 90 chars: 80 for description, 8 for pkgdesc and 2 for ''
51 syn match pbIllegalPkgdesc /.\{90,}\|=['"]\?.*['" ]\+[iI][sS] [aA]/ contained contains=pbPkgdescSign
52 syn match pbValidPkgdesc /[^='"]\.\{,80}/ contained contains=pbIllegalPkgdesc
53 syn match pbPkgdescGroup /^pkgdesc=.*/ contains=pbIllegalPkgdesc,pb_k_desc,pbValidPkgdesc,shDoubleQuote,shSingleQuote
54 syn match pbPkgdescSign /[='"]/ contained
56 " epoch
57 syn keyword pb_k_epoch epoch contained
58 syn match pbValidEpoch /[[:digit:]]*/ contained contains=pbIllegalEpoch
59 syn match pbIllegalEpoch /[^[:digit:]=]\|=.*=/ contained
60 syn match pbEpochGroup /^epoch=.*/ contains=pbIllegalEpoch,pbValidEpoch,pb_k_epoch,shDoubleQuote,shSingleQuote
62 " url
63 syn keyword pb_k_url url contained
64 syn match pbValidUrl /['"]*\(https\|http\|ftp\)\:\/.*\.\+.*/ contained
66 syn match pbIllegalUrl /[^=]/ contained contains=pbValidUrl
67 syn match pbUrlGroup /^url=.*/ contains=pbValidUrl,pb_k_url,pbIllegalUrl,shDoubleQuote,shSingleQuote
69 " license
70 syn keyword pb_k_license license contained
71 " echo $(pacman -Ql licenses | grep '/usr/share/licenses/common/' | cut -d'/' -f6 | sort -u)
72 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
73 " special cases from http://wiki.archlinux.org/index.php/Arch_Packaging_Standards
74 syn keyword pbLicenseSpecial  BSD MIT ZLIB Python contained
75 syn match pbLicenseCustom /custom\(:[[:alnum:]]*\)*/ contained
76 syn match pbIllegalLicense /[^='"() ]/ contained contains=pbLicenseCustom,pbLicenseSpecial,pbLicense
77 syn region pbLicenseGroup start=/^license=(/ end=/)/ contains=pb_k_license,pbLicenseCustom,pbLicenseSpecial,pbLicense,pbIllegalLicense
79 " backup
80 syn keyword pb_k_backup backup contained
81 syn match pbValidBackup   /\.\?[[:alpha:]]*\/[[:alnum:]\{\}+._$-]*]*/ contained
82 syn region pbBackupGroup start=/^backup=(/ end=/)/ contains=pb_k_backup,pbValidBackup,shDoubleQuote,shSingleQuote
84 " arch
85 syn keyword pb_k_arch arch contained
86 syn keyword pbArch i686 x86_64 ppc any contained
87 syn match pbIllegalArch /[^='"() ]/ contained contains=pbArch
88 syn region pbArchGroup start=/^arch=(/ end=/)/ contains=pb_k_arch,pbArch,pbIllegalArch
90 " groups
91 syn keyword pb_k_groups groups contained
92 syn match pbValidGroups /\([[:alnum:]]\|+\|-\|_\)*/ contained
93 syn region pbGroupsGroup start=/^groups=(/ end=/)/ contains=pb_k_groups,pbValidGroups,shDoubleQuote,shSingleQuote
95 " depends
96 syn keyword pb_k_depends depends contained
97 syn match pbValidDepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
98 syn region pbDependsGroup start=/^depends=(/ end=/)/ contains=pb_k_depends,pbValidDepends,shDoubleQuote,shSingleQuote
100 " makedepends
101 syn keyword pb_k_makedepends makedepends contained
102 syn match pbValidMakedepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
103 syn region pbMakedependsGroup start=/^makedepends=(/ end=/)/ contains=pb_k_makedepends,pbValidMakedepends,shDoubleQuote,shSingleQuote
105 " optdepends
106 syn keyword pb_k_optdepends optdepends contained
107 syn match pbValidOptdepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
108 syn region pbOptdependsGroup start=/^optdepends=(/ end=/)/ contains=pb_k_optdepends,pbValidOptdepends,shDoubleQuote,shSingleQuote
110 " checkdepends
111 syn keyword pb_k_ckdepends ckdepends contained
112 syn match pbValidCkdepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
113 syn region pbCkdependsGroup start=/^checkdepends=(/ end=/)/ contains=pb_k_ckdepends,pbValidCkdepends,shDoubleQuote,shSingleQuote
115 " conflicts
116 syn keyword pb_k_conflicts conflicts contained
117 syn match pbValidConflicts /\([[:alnum:]]\|+\|-\|_\)*/ contained
118 syn region pbConflictsGroup start=/^conflicts=(/ end=/)/ contains=pb_k_conflicts,pbValidConflicts,shDoubleQuote,shSingleQuote
120 " provides
121 syn keyword pb_k_provides provides contained
122 syn match pbValidProvides /\([[:alnum:]]\|+\|-\|_\)*/ contained
123 syn region pbProvidesGroup start=/^provides=(/ end=/)/ contains=pb_k_provides,pbValidProvides,shDoubleQuote,shSingleQuote
125 " replaces
126 syn keyword pb_k_replaces replaces contained
127 syn match pbValidReplaces /\([[:alnum:]]\|+\|-\|_\)*/ contained
128 syn region pbReplacesGroup start=/^replaces=(/  end=/)/ contains=pb_k_replaces,pbValidReplaces,shDoubleQuote,shSingleQuote
130 " install
131 " XXX remove install from bashStatement, fix strange bug
132 syn clear bashStatement
133 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
135 syn keyword pb_k_install install contained
136 syn match pbValidInstall /\([[:alnum:]]\|\$\|+\|-\|_\)*\.install/ contained
137 syn match pbIllegalInstall /[^=]/ contained contains=pbValidInstall
138 syn match pbInstallGroup /^install=.*/ contains=pb_k_install,pbValidInstall,pbIllegalInstall,shDeref,shDoubleQuote,shSingleQuote
140 " changelog
141 syn keyword pb_k_changelog changelog contained
142 syn match pbValidChangelog /\([[:alnum:]]\|\$\|+\|-\|_\)*/ contained
143 syn match pbIllegalChangelog /[^=]/ contained contains=pbValidChangelog
144 syn match pbChangelogGroup /^changelog=.*/ contains=pb_k_changelog,pbValidChangelog,pbIllegalChangelog,shDeref,shDoubleQuote,shSingleQuote
146 " source:
147 " XXX remove source from shStatement, fix strange bug
148 syn clear shStatement
149 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
151 syn keyword pb_k_source source contained
152 syn match pbIllegalSource /\(http\|ftp\|https\).*\.\+\(dl\|download.\?\)\.\(sourceforge\|sf\).net/
153 syn region pbSourceGroup  start=/^source=(/ end=/)/ contains=pb_k_source,pbIllegalSource,shNumber,shDoubleQuote,shSingleQuote,pbDerefEmulation
154 syn match pbDerefEmulation /\$[{]\?[[:alnum:]_]*[}]\?/ contained
155 hi def link pbDerefEmulation PreProc
157 " md5sums
158 syn keyword pb_k_md5sums md5sums contained
159 syn match pbIllegalMd5sums /[^='"()\/ ]/ contained contains=pbValidMd5sums
160 syn match pbValidMd5sums /\x\{32\}/ contained
161 syn region pbMd5sumsGroup start=/^md5sums/ end=/)/ contains=pb_k_md5sums,pbMd5Quotes,pbMd5Hash,pbIllegalMd5sums keepend
162 syn match pbMd5Quotes /'.*'\|".*"/ contained contains=pbMd5Hash,pbIllegalMd5sums
163 syn match pbMd5Hash /\x\+/ contained contains=pbValidMd5sums
164 hi def link pbMd5Quotes Keyword
165 hi def link pbMd5Hash Error
166 hi def link pbValidMd5sums  Number
168 " sha1sums
169 syn keyword pb_k_sha1sums sha1sums contained
170 syn match pbIllegalSha1sums /[^='"()\/ ]/ contained contains=pbValidSha1sums
171 syn match pbValidSha1sums /\x\{40\}/ contained
172 syn region pbSha1sumsGroup start=/^sha1sums/ end=/)/ contains=pb_k_sha1sums,pbSha1Quotes,pbSha1Hash,pbIllegalSha1sums keepend
173 syn match pbSha1Quotes /'.*'\|".*"/ contained contains=pbSha1Hash,pbIllegalSha1sums
174 syn match pbSha1Hash /\x\+/ contained contains=pbValidSha1sums
175 hi def link pbSha1Quotes Keyword
176 hi def link pbSha1Hash Error
177 hi def link pbValidSha1sums  Number
179 " options
180 syn keyword pb_k_options options contained
181 syn match pbOptions /\(no\)\?\(strip\|docs\|libtool\|emptydirs\|zipman\|ccache\|distcc\|makeflags\|buildflags\)/ contained
182 syn match   pbOptionsNeg     /\!/ contained
183 syn match   pbOptionsDeprec  /no/ contained
184 syn region pbOptionsGroup start=/^options=(/ end=/)/ contains=pb_k_options,pbOptions,pbOptionsNeg,pbOptionsDeprec,pbIllegalOption,shDoubleQuote,shSingleQuote
185 syn match pbIllegalOption /[^!"'()= ]/ contained contains=pbOptionsDeprec,pbOptions
187 " noextract
188 syn match pbNoextract /[[:alnum:]+._${}-]\+/ contained
189 syn keyword pb_k_noextract noextract  contained
190 syn region pbNoextractGroup  start=/^noextract=(/ end=/)/ contains=pb_k_noextract,pbNoextract,shDoubleQuote,shSingleQuote
192 " comments
193 syn keyword    pb_k_maintainer Maintainer Contributor contained
194 syn match      pbMaintainerGroup /Maintainer.*/ contains=pbMaintainer contained
196 syn match pbDate /[0-9]\{4}\/[0-9]\{2}\/[0-9]\{2}/ contained
198 syn cluster    pbCommentGroup   contains=pbTodo,pb_k_maintainer,pbMaintainerGroup,pbDate
199 syn keyword    pbTodo   contained       COMBAK FIXME TODO XXX
200 syn match      pbComment        "^#.*$" contains=@pbCommentGroup
201 syn match      pbComment        "[^0-9]#.*$"    contains=@pbCommentGroup
203 " quotes are handled by sh.vim
205 hi def link pbComment Comment
206 hi def link pbTodo Todo
208 hi def link pbIllegalPkgname Error
209 hi def link pb_k_pkgname pbKeywords
211 hi def link pbIllegalPkgbase Error
212 hi def link pb_k_pkgbase pbKeywords
214 hi def link pbIllegalPkgver Error
215 hi def link pb_k_pkgver pbKeywords
217 hi def link pbIllegalPkgrel Error
218 hi def link pb_k_pkgrel pbKeywords
220 hi def link pbIllegalPkgdesc Error
221 hi def link pb_k_desc pbKeywords
223 hi def link pbIllegalUrl Error
224 hi def link pb_k_url pbKeywords
226 hi def link pb_k_license pbKeywords
227 hi def link pbIllegalLicense Error
229 hi def link pb_k_backup pbKeywords
231 hi def link pb_k_arch pbKeywords
232 hi def link pbIllegalArch Error
234 hi def link pb_k_groups pbKeywords
235 hi def link pb_k_makedepends pbKeywords
236 hi def link pb_k_optdepends pbKeywords
237 hi def link pb_k_ckdepends pbKeywords
238 hi def link pb_k_depends pbKeywords
239 hi def link pb_k_replaces pbKeywords
240 hi def link pb_k_conflicts pbKeywords
241 hi def link pb_k_provides pbKeywords
243 hi def link pbIllegalInstall Error
244 hi def link pb_k_install pbKeywords
246 hi def link pbIllegalChangelog Error
247 hi def link pb_k_changelog pbKeywords
249 hi def link pb_k_source pbKeywords
250 hi def link pbIllegalSource Error
252 hi def link pb_k_md5sums pbKeywords
253 hi def link pbIllegalMd5sums Error
255 hi def link pb_k_sha1sums pbKeywords
256 hi def link pbIllegalSha1sums Error
258 hi def link pb_k_options pbKeywords
259 hi def link pbOptionsDeprec Todo
260 hi def link pbIllegalOption Error
262 hi def link pb_k_noextract pbKeywords
263 hi def link pbNoextract Normal
265 hi def link pb_k_maintainer pbKeywords
267 hi def link pbKeywords Keyword
269 hi def link pbDate Special
271 "syntax include @SHELL syntax/sh.vim
272 "syntax region BUILD start=/^build()/ end=/^}/ contains=@SHELL
273 "let b:current_syntax = "PKGBUILD"
275 " vim: ft=vim