]> git.pld-linux.org Git - packages/vim.git/blame - spec.vim
- updated apache config file detecting in SOURCES; rel 3
[packages/vim.git] / spec.vim
CommitLineData
18f77c52
ER
1" Filename: spec.vim
2" Purpose: Vim syntax file
3" Language: SPEC: Build/install scripts for Linux RPM packages
4" Maintainer: Donovan Rebbechi elflord@pegasus.rutgers.edu
5" URL: http://pegasus.rutgers.edu/~elflord/vim/syntax/spec.vim
6" Last Change: Tue Oct 3 17:35:15 BRST 2000 <aurelio@conectiva.com.br>
7
8" For version 5.x: Clear all syntax items
9" For version 6.x: Quit when a syntax file was already loaded
10if version < 600
11 syntax clear
12elseif exists("b:current_syntax")
13 finish
14endif
15
16syn sync minlines=1000
17
06d78f8d 18syn match specSpecialChar contained '[][!$()\\|>^;:]'
18f77c52
ER
19syn match specColon contained ':'
20syn match specPercent contained '%'
21
22syn match specVariables contained '\$\h\w*' contains=specSpecialVariablesNames,specSpecialChar
23syn match specVariables contained '\${\w*}' contains=specSpecialVariablesNames,specSpecialChar
24
25syn match specMacroIdentifier contained '%\h\w*' contains=specMacroNameLocal,specMacroNameOther,specPercent
06d78f8d
ER
26"syn match specMacroIdentifier contained '%{\w*}' contains=specMacroNameLocal,specMacroNameOther,specPercent,specSpecialChar
27syn region specMacroIdentifier oneline matchgroup=Special start='%{' skip='\\}' end='}' contains=specMacroNameLocal,specMacroNameOther,specPercent,specSpecialChar
28syn match specBcond contained '%{with\(out\)\?\s\+[a-zA-Z0-9_-]\+}'
18f77c52
ER
29
30syn match specSpecialVariables contained '\$[0-9]\|\${[0-9]}'
7da61caa 31syn match specCommandOpts contained '\s\(-\w\+\|--\w[a-zA-Z0-9_-]\+\)'ms=s+1
18f77c52
ER
32syn match specComment '^\s*#.*$'
33
34
35syn case match
36
37
983d4cf0 38" matches with no highlight
18f77c52
ER
39syn match specNoNumberHilite 'X11\|X11R6\|[a-zA-Z]*\.\d\|[a-zA-Z][-/]\d'
40syn match specManpageFile '[a-zA-Z]\.1'
41
983d4cf0 42" Day, Month and most used license acronyms
18f77c52
ER
43syn keyword specLicense contained GPL LGPL BSD MIT GNU
44syn keyword specWeekday contained Mon Tue Wed Thu Fri Sat Sun
45syn keyword specMonth contained Jan Feb Mar Apr Jun Jul Aug Sep Oct Nov Dec
46syn keyword specMonth contained January February March April May June July August September October November December
47
983d4cf0 48" #, @, www
18f77c52
ER
49syn match specNumber '\(^-\=\|[ \t]-\=\|-\)[0-9.-]*[0-9]'
50syn match specEmail contained "<\=\<[A-Za-z0-9_.-]\+@\([A-Za-z0-9_-]\+\.\)\+[A-Za-z]\+\>>\="
09c38e14 51syn match specURL contained '\<\(\(https\{0,1}\|ftp\)://\|\(www[23]\{0,1}\.\|ftp\.\)\)[A-Za-z0-9._/~:,#?=-]\+\>'
18f77c52
ER
52syn match specURLMacro contained '\<\(\(https\{0,1}\|ftp\)://\|\(www[23]\{0,1}\.\|ftp\.\)\)[A-Za-z0-9._/~:,#%{}-]\+\>' contains=specMacroIdentifier
53
983d4cf0
ER
54" TODO take specSpecialVariables out of the cluster for the sh* contains (ALLBUT)
55" Special system directories
18f77c52
ER
56syn match specListedFilesPrefix contained '/\(usr\|local\|opt\|X11R6\|X11\)/'me=e-1
57syn match specListedFilesBin contained '/s\=bin/'me=e-1
58syn match specListedFilesLib contained '/\(lib\|include\)/'me=e-1
59syn match specListedFilesDoc contained '/\(man\d*\|doc\|info\)\>'
60syn match specListedFilesEtc contained '/etc/'me=e-1
61syn match specListedFilesShare contained '/share/'me=e-1
62syn cluster specListedFiles contains=specListedFilesBin,specListedFilesLib,specListedFilesDoc,specListedFilesEtc,specListedFilesShare,specListedFilesPrefix,specVariables,specSpecialChar
63
983d4cf0 64" specComands
18f77c52 65syn match specConfigure contained '\./configure'
4273bb63 66syn match specTarCommand contained '\<tar\s\+[cxvpzjf]\{,5}\s*'
58f56a33 67
7d7d47a3 68" XXX don't forget to update specScriptArea when updating specMacro
58f56a33
ER
69syn match specMacro contained '%\(group\|user\)\(add\|remove\)'
70syn match specMacro contained '%\(depmod\|banner\|service\|addusertogroup\)'
71syn match specMacro contained '%\(\(nsplugin\|apache_config\)_\(un\)\?install\)'
72syn match specMacro contained '%\(webapp_\(un\)\?register\)'
73syn match specMacro contained '%\(pear_package_\(setup\|install\)\)'
74syn match specMacro contained '%\(py_o\?comp\|py_postclean\)'
75
18f77c52 76syn keyword specCommandSpecial contained root
73b8e09b 77syn keyword specCommand contained make xmkmf mkdir chmod find sed rm strip moc echo grep ls rm mv mkdir chown install cp pwd cat tail then else elif cd gzip rmdir ln eval export touch unzip bzip2
3e77e77f 78syn cluster specCommands contains=specCommand,specTarCommand,specConfigure,specCommandSpecial,specMacro
18f77c52 79
983d4cf0 80" frequently used rpm env vars
18f77c52
ER
81syn keyword specSpecialVariablesNames contained RPM_BUILD_ROOT RPM_BUILD_DIR RPM_SOURCE_DIR RPM_OPT_FLAGS LDFLAGS CC CC_FLAGS CPPNAME CFLAGS CXX CXXFLAGS CPPFLAGS
82
983d4cf0 83" valid macro names from /usr/lib/rpm/macros
8d61db40
ER
84syn keyword specMacroNameOther contained buildroot buildsubdir distribution disturl ix86 name nil optflags perl_sitearch release requires_eq vendor version
85syn keyword specMacroNameOther contained __kernel_ver date debugcflags debuginfocflags epoch kgcc kgcc_package packager
86syn keyword specMacroNameOther contained pear_package_install pear_package_setup perl_archlib perl_privlib perl_sitelib
0febd985 87syn keyword specMacroNameOther contained perl_vendorarch perl_vendorlib php_pear_dir py_sitedir py_scriptdir py_sitescriptdir releq_kernel_smp
8d61db40
ER
88syn keyword specMacroNameOther contained releq_kernel_up requires_php_extension requires_releq_kernel_smp requires_releq_kernel_up
89syn keyword specMacroNameOther contained requires_zend_extension rpmcflags rpmcxxflags rpmldflags tmpdir x8664
c153f9a5 90syn keyword specMacroNameOther contained ruby_archdir ruby_rubylibdir ruby_ridir ruby_sitearchdir ruby_version
8d61db40 91
18f77c52
ER
92syn match specMacroNameOther contained '\<\(PATCH\|SOURCE\)\d*\>'
93
983d4cf0
ER
94" valid _macro names from /usr/lib/rpm/macros
95syn keyword specMacroNameLocal contained _aclocaldir _applnkdir _arch _binary_payload _bindir _build _build_arch _build_alias
96syn keyword specMacroNameLocal contained _build_cpu _builddir _build_os _buildshell _buildsubdir _build_vendor _bzip2bin _datadir
7d7d47a3 97syn keyword specMacroNameLocal contained _dbpath _dbpath_rebuild _defaultdocdir _desktopdir _docdir _examplesdir _excludedocs _kdedocdir
983d4cf0
ER
98syn keyword specMacroNameLocal contained _exec_prefix _fixgroup _fixowner _fixperms _fontsdir _ftpport _ftpproxy _gnu _gpg_name
99syn keyword specMacroNameLocal contained _gpg_path _gtkdocdir _gzipbin _host _host_alias _host_cpu _host_os _host_vendor
100syn keyword specMacroNameLocal contained _httpport _httpproxy _iconsdir _includedir _infodir _initrddir _install_langs
101syn keyword specMacroNameLocal contained _install_script_path _instchangelog _javaclasspath _javadir _javadocdir _kernelsrcdir
102syn keyword specMacroNameLocal contained _kernel_ver _kernel_ver_str _langpatt _lib _libdir _libexecdir _localstatedir _mandir
103syn keyword specMacroNameLocal contained _netsharedpath _oldincludedir _omf_dest_dir _os _package_version _pgpbin _pgp_name
104syn keyword specMacroNameLocal contained _pgp_path _pixmapsdir _pkgconfigdir _prefix _preScriptEnvironment _provides _rpmdir
105syn keyword specMacroNameLocal contained _rpmfilename _sbindir _sharedstatedir _signature _smp_mflags _sourcedir _source_payload
106syn keyword specMacroNameLocal contained _specdir _srcrpmdir _sysconfdir _target _target_alias _target_cpu _target_os _target_platform
107syn keyword specMacroNameLocal contained _target_vendor _target_base_arch _timecheck _tmppath _topdir _usr _usrsrc _var _vendor
c153f9a5
ER
108syn keyword specMacroNameLocal contained __cxx __cc __make __perl __libtoolize __autopoint __aclocal __autoconf __automake __autoheader
109syn keyword specMacroNameLocal contained __gettextize __sed __intltoolize __install
18f77c52
ER
110
111
983d4cf0 112" ------------------------------------------------------------------------------
18f77c52
ER
113" here's is all the spec sections definitions: PreAmble, Description, Package,
114" Scripts, Files and Changelog
115
983d4cf0
ER
116" One line macros - valid in all ScriptAreas
117" tip: remember do include new items on specScriptArea's skip section
06d78f8d 118syn region specSectionMacroArea oneline matchgroup=specSectionMacro start='^%\(\(un\)\?define\|dump\|trace\|patch\d*\|setup\|configure2_13\|configure\|GNUconfigure\|find_lang\|makeinstall\|bcond_with\(out\)\?\|include\)\>' end='$' contains=specCommandOpts,specMacroIdentifier,specSectionMacroBcondArea
811b82fb 119syn region specSectionMacroBracketArea oneline matchgroup=specSectionMacro start='^%{\(configure2_13\|configure\|GNUconfigure\|find_lang\|makeinstall\)}' end='$' contains=specCommandOpts,specMacroIdentifier
06d78f8d 120syn region specSectionMacroBcondArea oneline matchgroup=specBlock start='%{!\??\(with\(out\)\?_[a-zA-Z0-9_]\+\|debug\):' skip='\\}' end='}' contains=ALLBUT,shCase
18f77c52 121
983d4cf0
ER
122" %% Files Section %%
123" TODO %config valid parameters: missingok\|noreplace
124" TODO %verify valid parameters: \(not\)\= \(md5\|atime\|...\)
84cc767b 125syn region specFilesArea matchgroup=specSection start='^%[Ff][Ii][Ll][Ee][Ss]\>' skip='%\(attrib\|defattr\|attr\|dir\|config\|docdir\|doc\|lang\|verify\|ghost\|exclude\|dev\|if\|else\|endif\)\>' end='^%[a-zA-Z]'me=e-2 contains=specFilesOpts,specFilesDirective,@specListedFiles,specComment,specCommandSpecial,specMacroIdentifier,specSectionMacroBcondArea,specIf
983d4cf0 126" tip: remember to include new items in specFilesArea above
53534d87 127syn match specFilesDirective contained '%\(attrib\|defattr\|attr\|dir\|config\|docdir\|doc\|lang\|verify\|ghost\|exclude\|dev\)\>'
18f77c52 128
983d4cf0 129" valid options for certain section headers
18f77c52
ER
130syn match specDescriptionOpts contained '\s-[ln]\s*\a'ms=s+1,me=e-1
131syn match specPackageOpts contained '\s-n\s*\w'ms=s+1,me=e-1
132syn match specFilesOpts contained '\s-f\s*\w'ms=s+1,me=e-1
133
134
135syn case ignore
136
137
983d4cf0
ER
138" %% PreAmble Section %%
139" Copyright and Serial were deprecated by License and Epoch
18f77c52 140syn region specPreAmbleDeprecated oneline matchgroup=specError start='^\(Copyright\|Serial\)' end='$' contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier
41131cd0
ER
141syn region specPreAmble oneline matchgroup=specCommand
142 \ start='\(^\|\(^%{!\??\(with\(out\)\?_[a-zA-Z0-9_]\+\|debug\):\)\@<=\)\(Prereq\|Summary\|Name\|Version\|Packager\|Requires\|Icon\|URL\|Source\d*\|Patch\d*\|Prefix\|Packager\|Group\|License\|Release\|BuildRoot\|Distribution\|Vendor\|Provides\|ExclusiveArch\|ExcludeArch\|ExclusiveOS\|Obsoletes\|BuildArch\|BuildArchitectures\|BuildRequires\|BuildConflicts\|BuildPreReq\|Conflicts\|AutoRequires\|AutoReqProv\|AutoReq\|AutoProv\|Epoch\|NoSource\)'
143 \ end='$\|}\@='
144 \ contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier,specSectionMacroBcondArea
18f77c52 145
983d4cf0 146" %% Description Section %%
18f77c52
ER
147syn region specDescriptionArea matchgroup=specSection start='^%description' end='^%'me=e-1 contains=specDescriptionOpts,specEmail,specURL,specNumber,specMacroIdentifier,specComment
148
983d4cf0 149" %% Package Section %%
18f77c52
ER
150syn region specPackageArea matchgroup=specSection start='^%package' end='^%'me=e-1 contains=specPackageOpts,specPreAmble,specComment
151
983d4cf0 152" %% Scripts Section %%
3e77e77f 153syn region specScriptArea matchgroup=specSection
26aea1c6 154 \ start='^%\(prep\|build\|install\|clean\|pre\|postun\|preun\|post\|triggerin\|triggerun\|triggerpostun\|pretrans\|posttrans\|verifyscript\)\>'
58f56a33 155 \ skip='^%{\|^%\(define\|patch\d*\|configure2_13\|configure\|GNUconfigure\|setup\|find_lang\|makeinstall\|useradd\|groupadd\|addusertogroup\|banner\|service\|py_o\?comp\|py_postclean\|\(\(nsplugin\|apache_config\)_\(un\)\?install\)\|webapp_\(un\)\?register\|depmod\|pear_package_\(setup\|install\)\)\>'
3e77e77f
ER
156 \ end='^%'me=e-1
157 \ contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2,specSectionMacroBcondArea
7d7d47a3 158" XXX don't forget to update specMacro when updating specScriptArea
18f77c52 159
983d4cf0 160" %% Changelog Section %%
bc8bbced
ER
161syn region specChangelogArea matchgroup=specSection start='^%changelog' end='^%'me=e-1
162 \ contains=specEmail,specURL,specWeekday,specMonth,specNumber,specComment,specLicense,specRevision,specLogMessage,specLogError
18f77c52 163
09c38e14
ER
164syn match specRevision contained "^Revision [.0-9]\+ [/0-9]\+ [:0-9]\+ [a-zA-Z0-9]\+$"
165syn region specLogMessage contained start="^[- ] " end="$" contains=specLogError,specURL,specEmail
09c38e14 166syn match specLogError contained "%%"
18f77c52 167
983d4cf0
ER
168" ------------------------------------------------------------------------------
169" here's the shell syntax for all the Script Sections
18f77c52
ER
170
171
172syn case match
173
174
983d4cf0 175" sh-like comment style, only valid in script part
18f77c52
ER
176syn match shComment contained '#.*$'
177
178syn region shQuote1 contained matchgroup=shQuoteDelim start=+'+ skip=+\\'+ end=+'+ contains=specMacroIdentifier
06d78f8d 179syn region shQuote2 contained matchgroup=shQuoteDelim start=+"+ skip=+\\"+ end=+"+ contains=specVariables,specMacroIdentifier,specSectionMacroBcondArea
18f77c52
ER
180
181syn match shOperator contained '[><|!&;]\|[!=]='
182syn region shDo transparent matchgroup=specBlock start="\<do\>" end="\<done\>" contains=ALLBUT,shFunction,shDoError,shCase,specPreAmble,@specListedFiles
183
d83fcd4c 184syn region specIf matchgroup=specBlock start="%ifosf\|%ifos\|%ifnos\|%ifarch\|%ifnarch\|ifdef\|ifndef\|%if\|%else" end='%endif' contains=ALLBUT, specIfError, shCase, shComment
18f77c52 185
983d4cf0 186syn region shIf transparent matchgroup=specBlock start="\<if\>" end="\<fi\>" contains=ALLBUT,shFunction,shIfError,shCase,@specListedFiles
18f77c52 187
983d4cf0 188syn region shFor matchgroup=specBlock start="\<for\>" end="\<in\>" contains=ALLBUT,shFunction,shInError,shCase,@specListedFiles
18f77c52
ER
189
190syn region shCaseEsac transparent matchgroup=specBlock start="\<case\>" matchgroup=NONE end="\<in\>"me=s-1 contains=ALLBUT,shFunction,shCaseError,@specListedFiles nextgroup=shCaseEsac
191syn region shCaseEsac matchgroup=specBlock start="\<in\>" end="\<esac\>" contains=ALLBUT,shFunction,shCaseError,@specListedFilesBin
192syn region shCase matchgroup=specBlock contained start=")" end=";;" contains=ALLBUT,shFunction,shCaseError,shCase,@specListedFiles
193
194syn sync match shDoSync grouphere shDo "\<do\>"
195syn sync match shDoSync groupthere shDo "\<done\>"
196syn sync match shIfSync grouphere shIf "\<if\>"
197syn sync match shIfSync groupthere shIf "\<fi\>"
198syn sync match specIfSync grouphere specIf "%ifarch\|%ifos\|%ifnos"
199syn sync match specIfSync groupthere specIf "%endIf"
200syn sync match shForSync grouphere shFor "\<for\>"
201syn sync match shForSync groupthere shFor "\<in\>"
202syn sync match shCaseEsacSync grouphere shCaseEsac "\<case\>"
203syn sync match shCaseEsacSync groupthere shCaseEsac "\<esac\>"
204
205" Define the default highlighting.
206" For version 5.7 and earlier: only when not done already
207" For version 5.8 and later: only when an item doesn't have highlighting yet
208if version >= 508 || !exists("did_spec_syntax_inits")
209 if version < 508
210 let did_spec_syntax_inits = 1
211 command -nargs=+ HiLink hi link <args>
212 else
213 command -nargs=+ HiLink hi def link <args>
214 endif
215
216 "main types color definitions
217 HiLink specSection Structure
218 HiLink specSectionMacro Macro
219 HiLink specWWWlink PreProc
220 HiLink specOpts Operator
221
222 "yes, it's ugly, but white is sooo cool
223 if &background == "dark"
224 hi def specGlobalMacro ctermfg=white
225 else
226 HiLink specGlobalMacro Identifier
227 endif
228
229 "sh colors
230 HiLink shComment Comment
231 HiLink shIf Statement
232 HiLink shOperator Special
233 HiLink shQuote1 String
234 HiLink shQuote2 String
235 HiLink shQuoteDelim Statement
236
983d4cf0 237 " spec colors
18f77c52 238 HiLink specBlock Function
06d78f8d 239 HiLink specBcond Function
18f77c52
ER
240 HiLink specColon Special
241 HiLink specCommand Statement
242 HiLink specCommandOpts specOpts
243 HiLink specCommandSpecial Special
244 HiLink specComment Comment
245 HiLink specConfigure specCommand
246 HiLink specDate String
247 HiLink specDescriptionOpts specOpts
248 HiLink specEmail specWWWlink
249 HiLink specError Error
250 HiLink specFilesDirective specSectionMacro
251 HiLink specFilesOpts specOpts
252 HiLink specLicense String
253 HiLink specMacroNameLocal specGlobalMacro
254 HiLink specMacroNameOther specGlobalMacro
255 HiLink specManpageFile NONE
256 HiLink specMonth specDate
257 HiLink specNoNumberHilite NONE
258 HiLink specNumber Number
259 HiLink specPackageOpts specOpts
260 HiLink specPercent Special
261 HiLink specSpecialChar Special
262 HiLink specSpecialVariables specGlobalMacro
263 HiLink specSpecialVariablesNames specGlobalMacro
264 HiLink specTarCommand specCommand
3e77e77f 265 HiLink specMacro Macro
18f77c52
ER
266 HiLink specURL specWWWlink
267 HiLink specURLMacro specWWWlink
268 HiLink specVariables Identifier
269 HiLink specWeekday specDate
270 HiLink specListedFilesBin Statement
271 HiLink specListedFilesDoc Statement
272 HiLink specListedFilesEtc Statement
273 HiLink specListedFilesLib Statement
274 HiLink specListedFilesPrefix Statement
275 HiLink specListedFilesShare Statement
276
09c38e14
ER
277 HiLink specRevision Number
278 HiLink specLogMessage Identifier
09c38e14
ER
279 HiLink specLogError Error
280
18f77c52
ER
281 delcommand HiLink
282endif
283
284let b:current_syntax = "spec"
285
286" vim: ts=8
This page took 0.513255 seconds and 4 git commands to generate.