Debian Codegraph @

data/syntax/rpmspec.xml

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE language [
3 <!ENTITY a_valid_char_in_macro_names "A-Za-z0-9_">
4 <!ENTITY command_section_name "(prep|build|pre|preun|install|post|postun|clean|files|trigger|triggerin|triggerun|triggerpostun|verifyscript|check|pretrans|posttrans|filetriggerin|filetriggerun|filetriggerpostun|transfiletriggerin|transfiletriggerun|transfiletriggerpostun)">
5 <!ENTITY arch "(aarch64|alpha|alphaev5|alphaev56|alphaev6|alphaev67|alphapca56|amd64|armv3l|armv4b|armv4l|armv4tl|armv5tejl|armv5tel|armv5tl|armv6hl|armv6l|armv7hl|armv7hnl|armv7l|atariclone|atarist|atariste|ataritt|athlon|em64t|falcon|fat|geode|hades|hppa1\.0|hppa1\.1|hppa1\.2|hppa2\.0|i370|i386|i486|i586|i686|ia32e|ia64|IP|m68k|m68kmint|milan|mips|mips64|mips64el|mips64r6|mips64r6el|mipsel|mipsr6|mipsr6el|noarch|osfmach3_i386|osfmach3_i486|osfmach3_i586|osfmach3_i686|osfmach3_ppc|parisc|pentium3|pentium4|powerpc|powerppc|ppc|ppc32dy4|ppc64|ppc64iseries|ppc64le|ppc64p7|ppc64pseries|ppc8260|ppc8560|ppciseries|ppcpseries|riscv|riscv64|rs6000|s390|s390x|sh|sh3|sh4|sh4a|sparc|sparc64|sparc64v|sparcv8|sparcv9|sparcv9v|sun4|sun4c|sun4d|sun4m|sun4u|x86_64|xtensa)">
6 <!ENTITY os "(AIX|AmigaOS|bsdi|bsdi4\.0|BSD_OS|cygwin32|CYGWIN32_95|CYGWIN32_NT|darwin|Darwin|FreeBSD|FreeMiNT|HP-UX|hpux10|hpux10\.00|hpux10\.01|hpux10\.10|hpux10\.20|hpux10\.30|hpux11\.00|hpux9\.04|hpux9\.05|hpux9\.07|Irix|IRIX|Irix64|IRIX64|Linux|Linux\/390|Linux\/ESA|machten|macosx|MacOSX|mint|MiNT|MP_RAS|ncr-sysv4\.2|ncr-sysv4\.3|NextStep|NEXTSTEP|OS\/390|osf1|OSF1|osf3\.2|osf4\.0|SCO_SV|SCO_SV3\.2v5\.0\.2|solaris|solaris2\.3|solaris2\.4|solaris2\.5|solaris2\.6|solaris2\.7|SunOS|SunOS4|SunOS5|TOS|UNIX_SV|VM\/ESA)">
7 <!ENTITY arch_conditionals_names "(ifarch|ifnarch)">
8 <!ENTITY os_conditionals_names "(ifos|ifnos)">
9 <!ENTITY predefined_commands "(if|&arch_conditionals_names;|&os_conditionals_names;|else|endif|define|undefine|package|description|&command_section_name;|changelog)($|[^&a_valid_char_in_macro_names;])">
10 <!ENTITY lookahead_whitespace_eol "(?=($| |\t))">
11 ]>
12 <language name="RPM Spec" version="12" kateversion="5.79" section="Other" extensions="*.spec" mimetype="text/x-rpm-spec" license="Public Domain">
13
14 <!-- The entities "arch" and "os" are based on /usr/lib/rpm/rpmrc (in the version coming with openSUSE 11.4). -->
15
16 <highlighting>
17
18 <list name="weekdays">
19 <item>Mon</item>
20 <item>Tue</item>
21 <item>Wed</item>
22 <item>Thu</item>
23 <item>Fri</item>
24 <item>Sat</item>
25 <item>Sun</item>
26 </list>
27
28 <list name="month names">
29 <item>Jan</item>
30 <item>Feb</item>
31 <item>Mar</item>
32 <item>Apr</item>
33 <item>May</item>
34 <item>Jun</item>
35 <item>Jul</item>
36 <item>Aug</item>
37 <item>Sep</item>
38 <item>Oct</item>
39 <item>Nov</item>
40 <item>Dec</item>
41 </list>
42
43 <list name="days">
44 <item>1</item>
45 <item>2</item>
46 <item>3</item>
47 <item>4</item>
48 <item>5</item>
49 <item>6</item>
50 <item>7</item>
51 <item>8</item>
52 <item>9</item>
53 <item>01</item>
54 <item>02</item>
55 <item>03</item>
56 <item>04</item>
57 <item>05</item>
58 <item>06</item>
59 <item>07</item>
60 <item>08</item>
61 <item>09</item>
62 <item>10</item>
63 <item>11</item>
64 <item>12</item>
65 <item>13</item>
66 <item>14</item>
67 <item>15</item>
68 <item>16</item>
69 <item>17</item>
70 <item>18</item>
71 <item>19</item>
72 <item>20</item>
73 <item>21</item>
74 <item>22</item>
75 <item>23</item>
76 <item>24</item>
77 <item>25</item>
78 <item>26</item>
79 <item>27</item>
80 <item>28</item>
81 <item>29</item>
82 <item>30</item>
83 <item>31</item>
84 </list>
85
86 <list name="bash_keyword">
87 <item>break</item>
88 <item>case</item>
89 <item>continue</item>
90 <item>do</item>
91 <item>done</item>
92 <item>elif</item>
93 <item>else</item>
94 <item>esac</item>
95 <item>fi</item>
96 <item>for</item>
97 <item>function</item>
98 <item>if</item>
99 <item>in</item>
100 <item>return</item>
101 <item>select</item>
102 <item>then</item>
103 <item>until</item>
104 <item>while</item>
105 </list>
106
107 <contexts>
108 <!-- "package section" is the context for the package definition. As it is the first context
109 in this file, it is also the context with which the interpreter starts. -->
110 <context attribute="Error" lineEndContext="#stay" name="package section">
111 <!-- Handle % -->
112 <DetectChar context="macro entry in package section" char="%" lookAhead="true" />
113 <!-- Handle tags: -->
114 <RegExpr attribute="Tag" context="tag_line_package" String="^(Conflicts|Obsoletes|Provides|Requires|Requires\([^)]*\)|Enhances|Suggests|BuildConflicts|BuildRequires|Recommends|PreReq|BuildPreReq|Supplements|OrderWithRequires|RemovePathPostfixes)[ \t]*:[ \t]*" column="0"/>
115 <RegExpr attribute="Tag" context="tag_line_string" String="^(Copyright|License|Summary|Summary\([^)]*\)|Distribution|Vendor|Packager|Group|Source\d*|Patch\d*|BuildRoot|Prefix)[ \t]*:[ \t]*" column="0"/>
116 <RegExpr attribute="Tag" context="tag_line_string_only_one_word" String="^(Name|Version|Release|Url|URL)[ \t]*:[ \t]*" column="0"/>
117 <RegExpr attribute="Tag" context="tag_line_os" String="^(ExclusiveOs|ExcludeOs)[ \t]*:[ \t]*" column="0"/>
118 <RegExpr attribute="Tag" context="tag_line_arch" String="^(BuildArch|BuildArchitectures|ExclusiveArch|ExcludeArch)[ \t]*:[ \t]*" column="0"/>
119 <RegExpr attribute="Tag" context="tag_line_integer" String="^(Epoch|Serial|Nosource|Nopatch)[ \t]*:[ \t]*" column="0"/>
120 <RegExpr attribute="Tag" context="tag_line_switch" String="^(AutoReq|AutoProv|AutoReqProv)[ \t]*:[ \t]*" column="0"/>
121 <RegExpr attribute="Tag" context="tag_line_value" String="^(Icon)[ \t]*:[ \t]*" column="0"/>
122 <!-- Handle comments. "# norootforbuild" is displayed like a tag. -->
123 <RegExpr context="Comment" String="^[ \t]*#" column="0" lookAhead="true" />
124 <!-- Spaces are okay -->
125 <DetectSpaces attribute="Fallback for separator spaces" />
126 <DetectIdentifier/>
127 <!-- Fallback value for every non-space -->
128 <!--RegExpr attribute="Error" context="#stay" String="[^\s]" /-->
129 </context>
130
131 <!-- "macro entry in package section" is used for lines in the package section that start
132 with a macro. It recognizes macros. Everything else is treated as normal text. This context
133 is used to prevent to highlight syntax errors after macros. With the next line break, this
134 context will switch back ("#pop"). -->
135 <context attribute="Shell commands" lineEndContext="#pop" name="macro entry in package section">
136 <!-- Handle % -->
137 <DetectChar context="handle_percent" char="%" lookAhead="true" />
138 <IncludeRules context="find_spaces_and_ident"/>
139 </context>
140
141 <!-- "package section start line" simply is used for the parameters after the
142 "%package" macro. With the next line break, it will switch to the
143 "package section" context which will handle everything else. -->
144 <context attribute="Shell commands" lineEndContext="package section" name="package section start line">
145 <!-- Handle % -->
146 <DetectChar context="handle_percent" char="%" lookAhead="true" />
147 </context>
148
149 <!-- "command section" is a generic context for all sections (like %prep, %build, %install...)
150 where you can enter shell commands. -->
151 <context attribute="Shell commands" lineEndContext="#stay" name="command section" fallthroughContext="#pop!shell in section">
152 <RegExpr attribute="Shell commands" String="\s+(?=.*-p\s+&lt;lua>)" context="#pop!command section lua"/>
153 </context>
154 <context attribute="Shell commands" lineEndContext="#pop!section lua" name="command section lua">
155 <DetectChar context="handle_percent" char="%" lookAhead="true" />
156 <IncludeRules context="find_spaces_and_ident"/>
157 </context>
158 <context attribute="Shell commands" lineEndContext="#stay" name="section lua">
159 <DetectChar context="handle_percent" char="%" lookAhead="1" column="0"/>
160 <IncludeRules context="##Lua"/>
161 </context>
162
163 <!-- "changelog section" is the context for the changelog. By default, everything that is
164 not recognized especially, is interpretated as changelog text. -->
165 <context attribute="String" lineEndContext="#stay" name="changelog section">
166 <!-- Handle calender date -->
167 <DetectChar attribute="Tag" context="changelog_weekday" char="*" column="0" />
168 <IncludeRules context="description section"/>
169 </context>
170
171 <!-- "description section start line" simply is used for the parameters after the
172 "%description" macro. With the next line break, it will switch to the
173 "description section" context which will handle the content of the description. -->
174 <context attribute="Shell commands" lineEndContext="#pop!description section" name="description section start line">
175 <!-- Handle % -->
176 <DetectChar context="handle_percent" char="%" lookAhead="true" />
177 </context>
178
179 <!-- "description section" is a follow-up context of "description section start line". See
180 there for further details. -->
181 <context attribute="String" lineEndContext="#stay" name="description section">
182 <!-- Handle % -->
183 <DetectChar context="handle_percent" char="%" lookAhead="true" />
184 <DetectIdentifier attribute="String"/>
185 <!-- Handle comments. "# norootforbuild" is displayed like a tag. -->
186 <RegExpr context="Comment" String="^[ \t]*#" column="0" lookAhead="true" />
187 <DetectSpaces attribute="String"/>
188 </context>
189
190 <!-- This is a convenience context that is handling comments automatically. Furthermore it
191 handles "# norootforbuild" because it looks like a comment. If a context supports comments,
192 simple use "<RegExpr context="Comment" String="^[ \t]*#" column="0" lookAhead="true" />".
193 (This context relies on the asumption that # is the first non-whitespace. We have to
194 guarantee this when calling this context! -->
195 <context attribute="Comment" lineEndContext="#pop" name="Comment">
196 <!-- While indeeted comments are not allowed by the standard (see section "Comments" at
197 http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch-specfile-syntax.html#id1961462),
198 rpmbuild accepts them nevertheless. We highlight them as comments, but we mark the
199 indeet. -->
200 <!-- Handle "# norootforbuild" and some of its miss-spellings. -->
201 <StringDetect attribute="Tag" context="every_non_whitespace_is_warning" String="# norootforbuild" column="0" />
202 <RegExpr attribute="Warning" context="#stay" String="#[ \t]*norootforbuild" firstNonSpace="1"/>
203 <RegExpr attribute="Hint" context="#stay" String="^[ \t]+(?=#)" column="0" />
204 <!-- Warning on single percent ("%"), but not on double percent ("%%"): -->
205 <Detect2Chars attribute="Comment" char="%" char1="%"/>
206 <DetectChar attribute="Warning" char="%"/>
207 <DetectSpaces />
208 <IncludeRules context="##Comments"/> <!-- Alert -->
209 <DetectIdentifier />
210 </context>
211
212 <!-- "every_non_whitespace_is_error" is a simple helper context. It switchs back to the
213 previous context at the end of the line. -->
214 <context attribute="Fallback for separator spaces" lineEndContext="#pop" name="every_non_whitespace_is_error">
215 <DetectSpaces attribute="Fallback for separator spaces"/>
216 <RegExpr attribute="Error" context="#stay" String="[^\s]+"/>
217 </context>
218
219 <!-- "every_non_whitespace_is_warning" is a simple helper context. It switchs back to the
220 previous context at the end of the line. -->
221 <context attribute="Fallback for separator spaces" lineEndContext="#pop" name="every_non_whitespace_is_warning">
222 <RegExpr attribute="Warning" context="#stay" String="[^\s]" />
223 </context>
224
225 <!-- "tag_line_value" is a context for enumeration values. It makes no further syntax
226 check. -->
227 <context attribute="Enumeration" lineEndContext="#pop" name="tag_line_value">
228 <!-- Handle % -->
229 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
230 </context>
231
232 <!-- "tag_line_string" is a context for string values. It makes no further syntax
233 check. -->
234 <context attribute="String" lineEndContext="#pop" name="tag_line_string">
235 <!-- Handle \ -->
236 <RegExpr attribute="Escaped character" String="\\[^%]|\\(?=(\%))" />
237 <!-- Handle % -->
238 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
239 </context>
240
241 <!-- "tag_line_string_only_one_word" is a context for string values. The first word is
242 highlighted as string, but after the first space (normal space, tab...), all other
243 words are highlighted as error. WARNING: This context requieres that there is no space at
244 the begin! -->
245 <context attribute="String" lineEndContext="#pop" name="tag_line_string_only_one_word">
246 <!-- Handle \ -->
247 <RegExpr attribute="Escaped character" String="\\[^%]|\\(?=(\%))" />
248 <!-- Handle % -->
249 <AnyChar context="tag_line_string" String="%$" lookAhead="true" />
250 <!-- Handle spaces -->
251 <DetectSpaces context="every_non_whitespace_is_error" />
252 </context>
253
254 <!-- "tag_line_integer" is a context for integer values. Non-integer context is marked as
255 error. -->
256 <context attribute="Error" lineEndContext="#pop" name="tag_line_integer" fallthroughContext="every_non_whitespace_is_error">
257 <Int attribute="Integer" context="every_non_whitespace_is_error" />
258 <!-- Handle % -->
259 <AnyChar context="tag_line_integer_without_syntax_check" String="%$" lookAhead="true" />
260 </context>
261
262 <!-- "tag_line_os" is a context for values that define the operation system. Unknown values
263 are marked as error. -->
264 <context attribute="Warning" lineEndContext="#pop" name="tag_line_os">
265 <!-- Spaces are okay -->
266 <DetectSpaces attribute="Fallback for separator spaces" />
267 <!-- Recognize valid values -->
268 <RegExpr attribute="Enumeration" String="&os;&lookahead_whitespace_eol;" />
269 <!-- Handle % -->
270 <AnyChar context="tag_line_value" String="%$" lookAhead="true" />
271 </context>
272
273 <!-- "tag_line_integer_without_syntax_check" is a context that is used internally by
274 "tag_line_integer" after macros. -->
275 <context attribute="Integer" lineEndContext="#pop" name="tag_line_integer_without_syntax_check">
276 <!-- Handle % -->
277 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
278 </context>
279
280 <!-- "tag_line_arch" is a context for values that define the computer type. Unknown values
281 are marked as error. -->
282 <context attribute="Warning" lineEndContext="#pop" name="tag_line_arch">
283 <!-- Spaces are okay -->
284 <DetectSpaces attribute="Fallback for separator spaces" />
285 <!-- Recognize valid values -->
286 <RegExpr attribute="Enumeration" String="&arch;&lookahead_whitespace_eol;" />
287 <!-- Handle % -->
288 <AnyChar context="tag_line_value" String="%$" lookAhead="true" />
289 </context>
290
291 <!-- "tag_line_package" is a context for dependency handling. The keywords <= >= == < > are
292 recognized and highlighted as keywords. Thee rest is simply highlighted as enumeration. See
293 http://docs.fedoraproject.org/drafts/rpm-guide-en/ch-specfile-syntax.html#id3045258 and
294 http://docs.fedoraproject.org/drafts/rpm-guide-en/ch-advanced-packaging.html#id2979270 for
295 details -->
296 <context attribute="Enumeration" lineEndContext="#pop" name="tag_line_package">
297 <AnyChar attribute="Keyword" context="#stay" String="()" /> <!-- See http://rpm5.org/docs/api/dependencies.html about the parentheses -->
298 <Detect2Chars attribute="Keyword" context="#stay" char="&lt;" char1="="/>
299 <Detect2Chars attribute="Keyword" context="#stay" char="&gt;" char1="="/>
300 <Detect2Chars attribute="Keyword" context="#stay" char="=" char1="="/>
301 <AnyChar attribute="Keyword" context="#stay" String="=&lt;&gt;," />
302 <!-- Handle % -->
303 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
304 </context>
305
306 <!-- "tag_line_switch" is a context that accepts "0", "1", "yes" and "no" as value.
307 Everything else is an error. See http://www.rpm.org/max-rpm-snapshot/s1-rpm-depend-auto-depend.html
308 and http://www.rpm.org/max-rpm/s1-rpm-inside-tags.html#S3-RPM-INSIDE-AUTOREQPROV-TAG -->
309 <context attribute="Error" lineEndContext="#pop" name="tag_line_switch" fallthroughContext="every_non_whitespace_is_error">
310 <AnyChar attribute="Enumeration" context="every_non_whitespace_is_error" String="01" />
311 <Detect2Chars attribute="Enumeration" context="every_non_whitespace_is_error" char="n" char1="o"/>
312 <StringDetect attribute="Enumeration" context="every_non_whitespace_is_error" String="yes" />
313 <!-- Handle % -->
314 <AnyChar context="tag_line_value" String="%$" lookAhead="true" />
315 </context>
316
317 <!-- A context that doesn't test for format errors in the changelog date anymore. Necessary
318 if macros are used. -->
319 <context attribute="Tag" lineEndContext="#pop" name="changelog_generic">
320 <!-- Handle % -->
321 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
322 </context>
323
324 <!-- A context that handles the weekday in the changelog date. -->
325 <context attribute="Tag" lineEndContext="#pop" name="changelog_weekday">
326 <DetectSpaces/>
327 <keyword context="changelog_month" attribute="Tag" String="weekdays" />
328 <!-- % handling without format errors in the date of the changelog -->
329 <AnyChar context="changelog_generic" String="%$" lookAhead="true" />
330 <RegExpr context="changelog_month" attribute="Error" String="\S*" />
331 </context>
332
333 <!-- A context that handles the month in the changelog date. -->
334 <context attribute="Tag" lineEndContext="#pop" name="changelog_month">
335 <DetectSpaces/>
336 <keyword context="changelog_day" attribute="Tag" String="month names" />
337 <!-- % handling without format errors in the date of the changelog -->
338 <AnyChar context="changelog_generic" String="%$" lookAhead="true" />
339 <RegExpr context="changelog_day" attribute="Error" String="\S*" />
340 </context>
341
342 <!-- A context that handles the day in the changelog date. -->
343 <context attribute="Tag" lineEndContext="#pop" name="changelog_day">
344 <DetectSpaces/>
345 <keyword context="changelog_year" attribute="Tag" String="days" />
346 <!-- % handling without format errors in the date of the changelog -->
347 <AnyChar context="changelog_generic" String="%$" lookAhead="true" />
348 <RegExpr context="changelog_year" attribute="Error" String="\S*" />
349 </context>
350
351 <!-- A context that handles the year in the changelog date. -->
352 <context attribute="Tag" lineEndContext="#pop" name="changelog_year">
353 <DetectSpaces/>
354 <RegExpr context="changelog_header" attribute="Tag" String="(\d{4})&lookahead_whitespace_eol;" />
355 <!-- % handling without format errors in the date of the changelog -->
356 <AnyChar context="changelog_generic" String="%$" lookAhead="true" />
357 <RegExpr context="changelog_header" attribute="Error" String="\S*" />
358 </context>
359
360 <!-- A context that handles the text after the date in a changelog (name, e-mail...). -->
361 <context attribute="Tag" lineEndContext="#pop" name="changelog_header">
362 <!-- Handle % -->
363 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
364 </context>
365
366 <!-- Handles everything that comes after %ifos etc... -->
367 <context attribute="Warning" lineEndContext="#pop" name="parameters after ifos">
368 <!-- Spaces are okay -->
369 <DetectSpaces attribute="Fallback for separator spaces" />
370 <!-- Recognize valid values -->
371 <RegExpr attribute="Enumeration" String="&os;&lookahead_whitespace_eol;" />
372 <!-- Handle % -->
373 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
374 </context>
375
376 <!-- Handles everything that comes after %ifarch etc... -->
377 <context attribute="Warning" lineEndContext="#pop" name="parameters after ifarch">
378 <!-- Spaces are okay -->
379 <DetectSpaces attribute="Fallback for separator spaces" />
380 <!-- Recognize valid values -->
381 <RegExpr attribute="Enumeration" String="&arch;&lookahead_whitespace_eol;" />
382 <!-- Handle % -->
383 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
384 </context>
385
386 <!-- Handles expressions after conditionals. -->
387 <context attribute="Error" lineEndContext="#pop" name="expression after _if_ statement">
388 <!-- spaces should not be "Error" (which is the default for unrecognized entities) -->
389 <DetectSpaces attribute="Fallback for separator spaces" context="#stay" />
390 <!-- %if recognizes && || > < >= <= == != ! and () -->
391 <AnyChar attribute="Keyword" context="#stay" String="()" />
392 <Detect2Chars attribute="Keyword" context="#stay" char="&amp;" char1="&amp;"/>
393 <Detect2Chars attribute="Keyword" context="#stay" char="&lt;" char1="="/>
394 <Detect2Chars attribute="Keyword" context="#stay" char="&gt;" char1="="/>
395 <Detect2Chars attribute="Keyword" context="#stay" char="=" char1="="/>
396 <Detect2Chars attribute="Keyword" context="#stay" char="!" char1="="/>
397 <AnyChar attribute="Keyword" context="#stay" String="!&lt;&gt;" />
398 <Detect2Chars attribute="Keyword" context="#stay" char="|" char1="|"/>
399 <!-- %if interpretates values either as integer or as string -->
400 <Int attribute="Integer" context="#stay" additionalDeliminator="!("/>
401 <DetectIdentifier attribute="String" context="#stay" />
402 <DetectChar attribute="String" context="quoted strings in if statements" char="&quot;" />
403 <!-- Handle % -->
404 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
405 </context>
406
407 <!-- This context handles quoted strings in %if statements. WARNING: Make sure that you
408 switch to this context _after_ parsing the starting ", because at the first occurrence
409 of " this context switches back. -->
410 <context attribute="String" lineEndContext="#pop" name="quoted strings in if statements">
411 <!-- Handle \ -->
412 <RegExpr attribute="Escaped character" String="\\[^&quot;]" />
413 <!-- Handle % -->
414 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
415 <!-- Switch back at the end of the quoted string -->
416 <DetectChar attribute="String" context="#pop" char="&quot;" />
417 </context>
418
419 <!-- Context for %define -->
420 <context attribute="Fallback for separator spaces" lineEndContext="#pop" name="macro definition">
421 <DetectSpaces />
422 <RegExpr attribute="Enumeration" context="macro definition content" String="[&a_valid_char_in_macro_names;]*(([(][)])|&lookahead_whitespace_eol;)" />
423 <RegExpr attribute="Error" context="macro definition content" String="[^ \t]*" />
424 </context>
425
426 <!-- Context for the content of a macro definition. -->
427 <context attribute="String" lineEndContext="#pop" name="macro definition content">
428 <IncludeRules context="find_spaces_and_ident"/>
429 <!-- Handle % -->
430 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
431 <LineContinue attribute="Line break" context="#stay"/>
432 <DetectChar attribute="Warning" char="\" />
433 </context>
434
435 <!-- Context for %undefine -->
436 <context attribute="Fallback for separator spaces" lineEndContext="#pop" name="undefine macro">
437 <DetectSpaces />
438 <RegExpr attribute="Enumeration" context="every_non_whitespace_is_error" String="[&a_valid_char_in_macro_names;]*&lookahead_whitespace_eol;" />
439 <RegExpr attribute="Error" context="every_non_whitespace_is_error" String="." />
440 </context>
441
442 <!-- This context handles automatically all type of macros, keywords and so on that start with % or $.
443 It expects a string starting with % or $ (otherwise, this context will fail!). -->
444 <context attribute="Fallback for separator spaces" lineEndContext="#pop" name="handle_percent">
445 <Detect2Chars attribute="Escaped character" context="#pop" char="%" char1="%"/>
446 <!-- Handle normal macros -->
447 <Detect2Chars attribute="Macro call" context="#pop!macro content in braces" char="%" char1="{" />
448 <Detect2Chars attribute="Macro call" context="#pop!macro content in parenthesis" char="%" char1="(" />
449 <!-- Keywords: -->
450 <RegExpr attribute="Control Flow" context="expression after _if_ statement" String="%(if!?)&lookahead_whitespace_eol;" firstNonSpace="true" beginRegion="if_block" />
451 <RegExpr attribute="Control Flow" context="parameters after ifarch" String="%&arch_conditionals_names;&lookahead_whitespace_eol;" firstNonSpace="true" beginRegion="if_block" />
452 <RegExpr attribute="Control Flow" context="parameters after ifos" String="%&os_conditionals_names;&lookahead_whitespace_eol;" firstNonSpace="true" beginRegion="if_block" />
453 <RegExpr attribute="Control Flow" context="every_non_whitespace_is_error" String="%else&lookahead_whitespace_eol;" firstNonSpace="true" endRegion="if_block" beginRegion="if_block" />
454 <RegExpr attribute="Control Flow" context="every_non_whitespace_is_error" String="%endif&lookahead_whitespace_eol;" firstNonSpace="true" endRegion="if_block" />
455 <RegExpr attribute="Keyword" context="macro definition" String="%(define|global)&lookahead_whitespace_eol;" firstNonSpace="true" />
456 <RegExpr attribute="Keyword" context="undefine macro" String="%undefine&lookahead_whitespace_eol;" firstNonSpace="true" />
457 <!-- If a command section starts (=section macro at begin of the line), we switch
458 to the corresponding context. There will never be a return to THIS context...: -->
459 <RegExpr attribute="Section" context="#pop#pop!package section start line" String="^%package&lookahead_whitespace_eol;" column="0" />
460 <RegExpr attribute="Section" context="#pop#pop!description section start line" String="^%description&lookahead_whitespace_eol;" column="0" />
461 <RegExpr attribute="Section" context="#pop#pop!command section" String="^%&command_section_name;&lookahead_whitespace_eol;" column="0" />
462 <RegExpr attribute="Section" context="#pop#pop!changelog section" String="^%changelog&lookahead_whitespace_eol;" column="0" />
463 <!-- Handle normal macros -->
464 <RegExpr attribute="Macro call" context="macro call in parenthesis" String="%(?!&predefined_commands;)[&a_valid_char_in_macro_names;]*\(" />
465 <RegExpr attribute="Macro call" context="#pop" String="%(?!&predefined_commands;)([&a_valid_char_in_macro_names;]+|[*#])(?=($|[^&a_valid_char_in_macro_names;]))" /> <!-- ')' and '}' are only allowed as macro terminator in the lookahead because when you do something like %__make %{?jobs:-j %jobs}, then the "%jobs" is a valid macro. However, the disadvantage is that a line like "%abc} isn't marked as error. But it is to complicate to distinguish this properly. -->
466 <RegExpr attribute="Error" context="#pop" String="%([&a_valid_char_in_macro_names;]+|[*#])?" /> <!-- a single % or $ is also an error -->
467 </context>
468
469 <!-- Used internally by "handle_percent" -->
470 <context attribute="Macro call" lineEndContext="#pop" name="normal macro content in braces">
471 <DetectChar attribute="Macro call" context="#pop" char="}" />
472 <DetectIdentifier attribute="Macro call"/>
473 <AnyChar attribute="Error" context="#stay" String="({)" />
474 <!--(This seems to be confusing instead of helping)AnyChar attribute="Keyword" context="#stay" String="!?:" /-->
475 <!-- Handle % -->
476 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
477 <DetectSpaces attribute="Macro call"/>
478 </context>
479
480 <context attribute="Shell commands" lineEndContext="#stay" name="macro_lua">
481 <DetectChar attribute="Macro call" context="#pop" char="}" />
482 <!-- Should exit on the first } found, even if this one is in a string,
483 but this is currently not possible -->
484 <IncludeRules context="##Lua"/>
485 </context>
486
487 <!-- Used internally by "handle_percent"
488 Context for %{ -->
489 <context attribute="Macro call" lineEndContext="#pop" name="macro content in braces" fallthroughContext="#pop!normal macro content in braces">
490 <StringDetect attribute="Macro call" context="#pop!macro_expand" String="expand:"/>
491 <StringDetect attribute="Macro call" context="#pop!macro_lua" String="lua:"/>
492 </context>
493
494 <!-- Used internally by "handle_percent"
495 Context for %xxx( -->
496 <context attribute="Macro call" lineEndContext="#pop#pop" name="macro call in parenthesis">
497 <DetectChar attribute="Macro call" context="#pop#pop" char=")" />
498 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
499 <DetectIdentifier attribute="Macro call"/>
500 </context>
501
502 <!-- Used internally by "handle_percent"
503 Context for %( -->
504 <context attribute="Shell commands" lineEndContext="#stay" name="macro content in parenthesis" fallthroughContext="shell_in_parenthesis_parameters">
505 <DetectChar attribute="Macro call" context="#pop" char=")"/>
506 <keyword attribute="Shell keyword" String="bash_keyword" additionalDeliminator="&amp;|);"/>
507 <DetectIdentifier attribute="Shell commands" context="shell_in_parenthesis_parameters"/>
508 <DetectSpaces attribute="Shell commands"/>
509 <AnyChar attribute="Shell symbol" String="&amp;|;!"/>
510 <DetectChar char="`" context="shell_in_parenthesis_bq" attribute="Shell symbol"/>
511 <Detect2Chars attribute="Shell variable" char="(" char1="(" context="shell_in_parenthesis_expr"/>
512 <DetectChar attribute="Shell symbol" char="(" context="shell_in_parenthesis_subcommand"/>
513 <DetectChar attribute="Comment" char="#" context="shell_in_parenthesis_comment"/>
514 <StringDetect attribute="Shell commands" String="[[ " context="shell_in_parenthesis_cond2"/>
515 <DetectChar attribute="Shell keyword" char="{" context="shell_in_parenthesis_brace"/>
516 <IncludeRules context="shell_find_redirections"/>
517 <RegExpr attribute="Shell commands" context="shell_in_parenthesis_parameters" String="[^ \t&lt;>|&amp;;()${}'&quot;`\\%#]++"/>
518 </context>
519
520 <context attribute="Shell commands" lineEndContext="#pop" name="find_spaces_and_ident">
521 <DetectSpaces/>
522 <DetectIdentifier/>
523 </context>
524
525 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_parenthesis_find_blank_and_ident" fallthroughContext="#pop">
526 <RegExpr attribute="Comment" String="^#|\s+#" context="shell_in_parenthesis_comment"/>
527 <RegExpr attribute="Shell keyword" String="(^|\s+)\{&lookahead_whitespace_eol;" context="shell_in_parenthesis_brace"/>
528 <IncludeRules context="find_spaces_and_ident"/>
529 </context>
530
531 <!-- %( with { -->
532 <context attribute="Shell commands" lineEndContext="#stay" name="shell_in_parenthesis_brace">
533 <DetectChar attribute="Shell keyword" context="#pop" char="}"/>
534 <DetectChar context="#pop" char=")" lookAhead="1"/>
535 <IncludeRules context="macro content in parenthesis"/>
536 </context>
537
538 <!-- %( with # -->
539 <context attribute="Comment" lineEndContext="#pop" name="shell_in_parenthesis_comment">
540 <DetectChar attribute="Comment" char="(" context="shell_in_parenthesis_comment_brace"/>
541 <DetectChar char=")" context="#pop" lookAhead="1"/>
542 <IncludeRules context="shell_in_section_comment"/>
543 </context>
544 <context attribute="Comment" lineEndContext="#pop" name="shell_in_parenthesis_comment_brace">
545 <DetectChar attribute="Comment" char=")" context="#pop"/>
546 <IncludeRules context="shell_in_parenthesis_comment"/>
547 </context>
548
549 <!-- %( with ` -->
550 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_parenthesis_bq" fallthroughContext="shell_in_parenthesis_parameters">
551 <DetectChar char="`" context="#pop" attribute="Shell symbol"/>
552 <DetectChar char=")" context="#pop" lookAhead="1"/>
553 <IncludeRules context="macro content in parenthesis"/>
554 </context>
555
556 <!-- %( with cmd ... -->
557 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_parenthesis_parameters">
558 <IncludeRules context="shell_in_parenthesis_find_blank_and_ident"/>
559 <AnyChar context="#pop" String=")`" lookAhead="1"/>
560 <AnyChar attribute="Shell symbol" String="&amp;|;" context="#pop"/>
561 <AnyChar attribute="Shell symbol" String="*?"/>
562 <DetectChar attribute="Shell commands" context="shell_in_parenthesis_parameters_brace" char="("/>
563 <IncludeRules context="shell_in_parenthesis_find_word"/>
564 <IncludeRules context="shell_find_redirections"/>
565 </context>
566 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_parenthesis_parameters_brace">
567 <DetectChar attribute="Shell commands" context="#pop" char=")"/>
568 <AnyChar String="&amp;|;" context="#pop" lookAhead="1"/>
569 <IncludeRules context="shell_in_parenthesis_parameters"/>
570 </context>
571
572 <!-- %( with [[ -->
573 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_parenthesis_cond2">
574 <Detect2Chars attribute="Shell commands" char="]" char1="]" context="#pop"/>
575 <AnyChar attribute="Shell symbol" String="&amp;|;"/>
576 <DetectChar attribute="Shell symbol" char="(" context="shell_in_parenthesis_sub_cond2"/>
577 <IncludeRules context="shell_in_parenthesis_parameters"/>
578 </context>
579 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_parenthesis_sub_cond2">
580 <DetectChar attribute="Shell symbol" char=")" context="#pop"/>
581 <AnyChar attribute="Shell symbol" String="&amp;|;"/>
582 <DetectChar attribute="Shell symbol" char="(" context="shell_in_parenthesis_sub_cond2"/>
583 <Detect2Chars char="]" char1="]" context="#pop" lookAhead="1"/>
584 <IncludeRules context="shell_in_parenthesis_parameters"/>
585 </context>
586
587 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_parenthesis_find_word" fallthroughContext="#pop">
588 <IncludeRules context="shell_in_parenthesis_find_variable"/>
589 <DetectChar attribute="Shell string" char="'" context="shell_in_parenthesis_sq_string"/>
590 <DetectChar attribute="Shell string" char="&quot;" context="shell_in_parenthesis_dq_string"/>
591 <IncludeRules context="shell_find_escape"/>
592 <DetectChar char="`" context="#pop" lookAhead="1"/>
593 </context>
594
595 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_parenthesis_find_variable">
596 <!-- Handle % -->
597 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
598 <Detect2Chars attribute="Shell string" char="$" char1="'" context="shell_in_parenthesis_variable_sq"/>
599 <StringDetect attribute="Shell variable" String="$((" context="shell_in_parenthesis_expr"/>
600 <Detect2Chars attribute="Shell symbol" char="$" char1="(" context="shell_in_parenthesis_subcommand"/>
601 <Detect2Chars attribute="Shell variable" char="$" char1="{" context="shell_in_parenthesis_variable_brace"/>
602 <DetectChar attribute="Shell variable" char="$" context="shell_single_variable"/>
603 </context>
604
605 <!-- %( with $' -->
606 <context attribute="Shell string" lineEndContext="#pop" name="shell_in_parenthesis_variable_sq">
607 <IncludeRules context="find_spaces_and_ident"/>
608 <DetectChar char="'" context="#pop" attribute="Shell string"/>
609 <DetectChar char=")" context="#pop" lookAhead="1"/>
610 <DetectChar char="(" context="shell_in_parenthesis_variable_sq_brace" attribute="Shell string"/>
611 <IncludeRules context="shell_find_escape"/>
612 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
613 </context>
614 <context attribute="Shell string" lineEndContext="#pop" name="shell_in_parenthesis_variable_sq_brace">
615 <DetectChar char="'" context="#pop" lookAhead="1"/>
616 <DetectChar char=")" context="#pop" attribute="Shell string"/>
617 <IncludeRules context="shell_in_parenthesis_variable_sq"/>
618 </context>
619
620 <!-- %( with $(( -->
621 <context attribute="Shell variable" lineEndContext="#pop" name="shell_in_parenthesis_expr">
622 <IncludeRules context="shell_in_parenthesis_find_blank_and_ident"/>
623 <Detect2Chars char=")" char1=")" context="#pop" attribute="Shell variable"/>
624 <DetectChar char=")" context="#pop!shell_in_parenthesis_subcommand" attribute="Shell variable"/>
625 <DetectChar char="(" context="shell_in_parenthesis_subexpr" attribute="Shell symbol"/>
626 <IncludeRules context="shell_in_parenthesis_find_word"/>
627 </context>
628 <context attribute="Shell variable" lineEndContext="#pop" name="shell_in_parenthesis_subexpr">
629 <IncludeRules context="shell_in_parenthesis_find_blank_and_ident"/>
630 <DetectChar char=")" context="#pop" attribute="Shell symbol"/>
631 <DetectChar char="(" context="shell_in_parenthesis_subexpr" attribute="Shell symbol"/>
632 <IncludeRules context="shell_in_parenthesis_find_word"/>
633 </context>
634
635 <!-- %( with $( -->
636 <context attribute="Shell string" lineEndContext="#pop" name="shell_in_parenthesis_subcommand">
637 <DetectChar char=")" context="#pop" attribute="Shell symbol"/>
638 <IncludeRules context="macro content in parenthesis"/>
639 </context>
640
641 <!-- %( with ${ -->
642 <context attribute="Shell variable" lineEndContext="#pop" name="shell_in_parenthesis_variable_brace">
643 <DetectChar char=")" context="#pop" lookAhead="1"/>
644 <DetectChar char="(" context="shell_in_parenthesis_variable_brace_parenthesis" attribute="Shell variable"/>
645 <DetectChar attribute="Shell variable" char="}" context="#pop"/>
646 <DetectChar attribute="Shell variable" char="{" context="shell_in_parenthesis_variable_brace"/>
647 <DetectIdentifier attribute="Shell variable"/>
648 <IncludeRules context="shell_in_parenthesis_find_word"/>
649 </context>
650 <context attribute="Shell variable" lineEndContext="#pop" name="shell_in_parenthesis_variable_brace_parenthesis">
651 <DetectChar char=")" context="#pop" attribute="Shell variable"/>
652 <IncludeRules context="shell_in_parenthesis_variable_brace"/>
653 </context>
654
655 <!-- %( with ' -->
656 <context attribute="Shell string" lineEndContext="#pop" name="shell_in_parenthesis_sq_string">
657 <IncludeRules context="find_spaces_and_ident"/>
658 <DetectChar char=")" context="#pop" lookAhead="1"/>
659 <DetectChar char="'" context="#pop" attribute="Shell string"/>
660 <DetectChar char="(" context="shell_in_parenthesis_sq_string_brace" attribute="Shell string"/>
661 <Detect2Chars char="\" char1=")" attribute="Escaped character"/>
662 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
663 </context>
664 <context attribute="Shell string" lineEndContext="#pop" name="shell_in_parenthesis_sq_string_brace">
665 <DetectChar char=")" context="#pop" attribute="Shell string"/>
666 <DetectChar char="'" context="#pop" lookAhead="1"/>
667 <IncludeRules context="shell_in_parenthesis_sq_string"/>
668 </context>
669
670 <!-- %( with " -->
671 <context attribute="Shell string" lineEndContext="#pop" name="shell_in_parenthesis_dq_string">
672 <IncludeRules context="find_spaces_and_ident"/>
673 <DetectChar char="&quot;" context="#pop" attribute="Shell string"/>
674 <DetectChar char=")" context="#pop" lookAhead="1"/>
675 <DetectChar char="(" context="shell_in_parenthesis_dq_string_brace" attribute="Shell string"/>
676 <IncludeRules context="shell_find_escape"/>
677 <IncludeRules context="shell_in_parenthesis_find_variable"/>
678 <DetectChar char="`" context="shell_in_parenthesis_bq" attribute="Shell symbol"/>
679 </context>
680 <context attribute="Shell string" lineEndContext="#pop" name="shell_in_parenthesis_dq_string_brace">
681 <DetectChar char="&quot;" context="#pop" lookAhead="1"/>
682 <DetectChar char=")" context="#pop" attribute="Shell string"/>
683 <IncludeRules context="shell_in_parenthesis_dq_string"/>
684 </context>
685
686
687 <!-- Used internally by "handle_percent"
688 Context for %{expand: -->
689 <context attribute="Shell commands" lineEndContext="#stay" name="macro_expand" fallthroughContext="shell_in_brace_parameters">
690 <DetectChar attribute="Macro call" context="#pop" char="}"/>
691 <WordDetect attribute="Shell keyword" String="function" context="shell_in_brace_function"/>
692 <keyword attribute="Shell keyword" String="bash_keyword" additionalDeliminator="&amp;|});"/>
693 <DetectIdentifier attribute="Shell commands" context="shell_in_brace_parameters"/>
694 <DetectSpaces attribute="Shell commands"/>
695 <AnyChar attribute="Shell symbol" String="&amp;|;!"/>
696 <DetectChar char="`" context="shell_in_brace_bq" attribute="Shell symbol"/>
697 <Detect2Chars attribute="Shell variable" char="(" char1="(" context="shell_in_brace_expr"/>
698 <DetectChar attribute="Shell symbol" char="(" context="shell_in_brace_subcommand"/>
699 <DetectChar attribute="Comment" char="#" context="shell_in_brace_comment"/>
700 <StringDetect attribute="Shell commands" String="[[ " context="shell_in_brace_cond2"/>
701 <DetectChar attribute="Shell keyword" char="{" context="shell_in_brace_brace"/>
702 <IncludeRules context="shell_find_redirections"/>
703 <RegExpr attribute="Shell commands" context="shell_in_brace_parameters" String="[^ \t&lt;>|&amp;;()${}'&quot;`\\%#]++"/>
704 </context>
705
706 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_brace_find_blank_and_ident" fallthroughContext="#pop">
707 <RegExpr attribute="Comment" String="^#|\s+#" context="shell_in_brace_comment"/>
708 <RegExpr attribute="Shell keyword" String="(^|\s+)\{&lookahead_whitespace_eol;" context="shell_in_brace_brace"/>
709 <IncludeRules context="find_spaces_and_ident"/>
710 </context>
711
712 <!-- %{expand with function -->
713 <context attribute="Shell commands" lineEndContext="#stay" name="shell_in_brace_function" fallthroughContext="#pop">
714 <DetectChar attribute="Shell keyword" context="#pop!shell_in_brace_brace" char="{"/>
715 <DetectChar context="#pop" char="}" lookAhead="1"/>
716 <Detect2Chars char="(" char1=")"/>
717 <IncludeRules context="find_spaces_and_ident"/>
718 </context>
719
720 <!-- %{expand with { -->
721 <context attribute="Shell commands" lineEndContext="#stay" name="shell_in_brace_brace">
722 <DetectChar attribute="Shell keyword" context="#pop" char="}"/>
723 <IncludeRules context="macro_expand"/>
724 </context>
725
726 <!-- %{expand with # -->
727 <context attribute="Comment" lineEndContext="#pop" name="shell_in_brace_comment">
728 <DetectChar attribute="Comment" char="{" context="shell_in_brace_comment_brace"/>
729 <DetectChar char="}" context="#pop" lookAhead="1"/>
730 <IncludeRules context="shell_in_section_comment"/>
731 </context>
732 <context attribute="Comment" lineEndContext="#pop" name="shell_in_brace_comment_brace">
733 <DetectChar attribute="Comment" char="}" context="#pop"/>
734 <IncludeRules context="shell_in_brace_comment"/>
735 </context>
736
737 <!-- %{expand with ` -->
738 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_brace_bq" fallthroughContext="shell_in_brace_parameters">
739 <DetectChar char="`" context="#pop" attribute="Shell symbol"/>
740 <DetectChar char="}" context="#pop" lookAhead="1"/>
741 <IncludeRules context="macro_expand"/>
742 </context>
743
744 <!-- %{expand with cmd ... -->
745 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_brace_parameters">
746 <IncludeRules context="shell_in_brace_find_blank_and_ident"/>
747 <AnyChar context="#pop" String="})`" lookAhead="1"/>
748 <AnyChar attribute="Shell symbol" String="&amp;|;" context="#pop"/>
749 <AnyChar attribute="Shell symbol" String="*?"/>
750 <DetectChar attribute="Shell commands" context="shell_in_brace_parameters_brace" char="{"/>
751 <IncludeRules context="shell_in_brace_find_word"/>
752 <IncludeRules context="shell_find_redirections"/>
753 </context>
754 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_brace_parameters_brace">
755 <DetectChar attribute="Shell commands" context="#pop" char="}"/>
756 <AnyChar String="&amp;|;" context="#pop" lookAhead="1"/>
757 <IncludeRules context="shell_in_brace_parameters"/>
758 </context>
759
760 <!-- %{expand with [[ -->
761 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_brace_cond2">
762 <Detect2Chars attribute="Shell commands" char="]" char1="]" context="#pop"/>
763 <AnyChar attribute="Shell symbol" String="&amp;|;"/>
764 <DetectChar attribute="Shell symbol" char="(" context="shell_in_brace_sub_cond2"/>
765 <IncludeRules context="shell_in_brace_parameters"/>
766 </context>
767 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_brace_sub_cond2">
768 <DetectChar attribute="Shell symbol" char=")" context="#pop"/>
769 <AnyChar attribute="Shell symbol" String="&amp;|;"/>
770 <DetectChar attribute="Shell symbol" char="(" context="shell_in_brace_sub_cond2"/>
771 <Detect2Chars char="]" char1="]" context="#pop" lookAhead="1"/>
772 <IncludeRules context="shell_in_brace_parameters"/>
773 </context>
774
775 <context attribute="Shell commands" lineEndContext="#pop" name="shell_find_redirections">
776 <RegExpr attribute="Shell redirection" context="shell_in_brace_find_word" String="([0-9]*>[>|&amp;]?|&amp;>>?|&lt;&lt;&lt;|&lt;[&amp;>]?)(&amp;[0-9]+|\s*[^\s{}()%$&amp;;|`]+)?"/>
777 </context>
778
779 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_brace_find_word" fallthroughContext="#pop">
780 <IncludeRules context="shell_in_brace_find_variable"/>
781 <DetectChar attribute="Shell string" char="'" context="shell_in_brace_sq_string"/>
782 <DetectChar attribute="Shell string" char="&quot;" context="shell_in_brace_dq_string"/>
783 <IncludeRules context="shell_find_escape"/>
784 <DetectChar char="`" context="#pop" lookAhead="1"/>
785 </context>
786
787 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_brace_find_variable">
788 <!-- Handle % -->
789 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
790 <Detect2Chars attribute="Shell string" char="$" char1="'" context="shell_in_brace_variable_sq"/>
791 <StringDetect attribute="Shell variable" String="$((" context="shell_in_brace_expr"/>
792 <Detect2Chars attribute="Shell symbol" char="$" char1="(" context="shell_in_brace_subcommand"/>
793 <Detect2Chars attribute="Shell variable" char="$" char1="{" context="shell_in_brace_variable_brace"/>
794 <DetectChar attribute="Shell variable" char="$" context="shell_single_variable"/>
795 </context>
796
797 <context attribute="Shell commands" lineEndContext="#pop" name="shell_find_escape">
798 <DetectChar attribute="Shell symbol" char="\" context="shell_in_brace_escape" lookAhead="1"/>
799 </context>
800 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_brace_escape">
801 <RegExpr attribute="Escaped character" context="#pop" String="\\."/>
802 <LineContinue attribute="Line break" context="#pop"/>
803 </context>
804
805 <!-- %{expand with $' -->
806 <context attribute="Shell string" lineEndContext="#pop" name="shell_in_brace_variable_sq">
807 <IncludeRules context="find_spaces_and_ident"/>
808 <DetectChar char="'" context="#pop" attribute="Shell string"/>
809 <DetectChar char="}" context="#pop" lookAhead="1"/>
810 <DetectChar char="{" context="shell_in_brace_variable_sq_brace" attribute="Shell string"/>
811 <IncludeRules context="shell_find_escape"/>
812 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
813 </context>
814 <context attribute="Shell string" lineEndContext="#pop" name="shell_in_brace_variable_sq_brace">
815 <DetectChar char="'" context="#pop" lookAhead="1"/>
816 <DetectChar char="}" context="#pop" attribute="Shell string"/>
817 <IncludeRules context="shell_in_brace_variable_sq"/>
818 </context>
819
820 <!-- %{expand with $(( -->
821 <context attribute="Shell variable" lineEndContext="#pop" name="shell_in_brace_expr">
822 <IncludeRules context="shell_in_brace_find_blank_and_ident"/>
823 <DetectChar char="}" context="#pop" lookAhead="1"/>
824 <Detect2Chars char=")" char1=")" context="#pop" attribute="Shell variable"/>
825 <DetectChar char=")" context="#pop!shell_in_brace_subcommand" attribute="Shell variable"/>
826 <DetectChar char="(" context="shell_in_brace_subexpr" attribute="Shell symbol"/>
827 <IncludeRules context="shell_in_brace_find_word"/>
828 </context>
829 <context attribute="Shell variable" lineEndContext="#pop" name="shell_in_brace_subexpr">
830 <IncludeRules context="shell_in_brace_find_blank_and_ident"/>
831 <DetectChar char="}" context="#pop" lookAhead="1"/>
832 <DetectChar char=")" context="#pop" attribute="Shell symbol"/>
833 <DetectChar char="(" context="shell_in_brace_subexpr" attribute="Shell symbol"/>
834 <IncludeRules context="shell_in_brace_find_word"/>
835 </context>
836
837 <!-- %{expand with $( -->
838 <context attribute="Shell string" lineEndContext="#pop" name="shell_in_brace_subcommand">
839 <DetectChar char="}" context="#pop" lookAhead="1"/>
840 <DetectChar char=")" context="#pop" attribute="Shell symbol"/>
841 <IncludeRules context="macro_expand"/>
842 </context>
843
844 <!-- %{expand with ${ -->
845 <context attribute="Shell variable" lineEndContext="#pop" name="shell_in_brace_variable_brace">
846 <DetectChar attribute="Shell variable" char="}" context="#pop"/>
847 <DetectChar attribute="Shell variable" char="{" context="shell_in_brace_variable_brace"/>
848 <DetectIdentifier attribute="Shell variable"/>
849 <IncludeRules context="shell_in_brace_find_word"/>
850 </context>
851
852 <!-- %{expand with $ -->
853 <context attribute="Shell variable" lineEndContext="#pop" name="shell_single_variable" fallthroughContext="#pop">
854 <DetectIdentifier attribute="Shell variable" context="#pop"/>
855 <AnyChar attribute="Shell variable" context="#pop" String="*@#?$!0123456789-"/>
856 </context>
857
858 <!-- %{expand with ' -->
859 <context attribute="Shell string" lineEndContext="#pop" name="shell_in_brace_sq_string">
860 <IncludeRules context="find_spaces_and_ident"/>
861 <DetectChar char="}" context="#pop" lookAhead="1"/>
862 <DetectChar char="'" context="#pop" attribute="Shell string"/>
863 <DetectChar char="{" context="shell_in_brace_sq_string_brace" attribute="Shell string"/>
864 <Detect2Chars char="\" char1="}" attribute="Escaped character"/>
865 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
866 </context>
867 <context attribute="Shell string" lineEndContext="#pop" name="shell_in_brace_sq_string_brace">
868 <DetectChar char="}" context="#pop" attribute="Shell string"/>
869 <DetectChar char="'" context="#pop" lookAhead="1"/>
870 <IncludeRules context="shell_in_brace_sq_string"/>
871 </context>
872
873 <!-- %{expand with " -->
874 <context attribute="Shell string" lineEndContext="#pop" name="shell_in_brace_dq_string">
875 <IncludeRules context="find_spaces_and_ident"/>
876 <DetectChar char="&quot;" context="#pop" attribute="Shell string"/>
877 <DetectChar char="}" context="#pop" lookAhead="1"/>
878 <DetectChar char="{" context="shell_in_brace_dq_string_brace" attribute="Shell string"/>
879 <IncludeRules context="shell_find_escape"/>
880 <IncludeRules context="shell_in_brace_find_variable"/>
881 <DetectChar char="`" context="shell_in_brace_bq" attribute="Shell symbol"/>
882 </context>
883 <context attribute="Shell string" lineEndContext="#pop" name="shell_in_brace_dq_string_brace">
884 <DetectChar char="&quot;" context="#pop" lookAhead="1"/>
885 <DetectChar char="}" context="#pop" attribute="Shell string"/>
886 <IncludeRules context="shell_in_brace_dq_string"/>
887 </context>
888
889
890 <!-- Used internally by "command section" -->
891 <context attribute="Shell commands" lineEndContext="#stay" name="shell in section" fallthroughContext="shell_in_section_parameters">
892 <keyword attribute="Shell keyword" String="bash_keyword" additionalDeliminator="&amp;|;"/>
893 <DetectIdentifier attribute="Shell commands" context="shell_in_section_parameters"/>
894 <DetectSpaces attribute="Shell commands"/>
895 <AnyChar attribute="Shell symbol" String="&amp;|;!"/>
896 <DetectChar char="`" context="shell_in_section_bq" attribute="Shell symbol"/>
897 <Detect2Chars attribute="Shell variable" char="(" char1="(" context="shell_in_parenthesis_expr"/>
898 <DetectChar attribute="Shell symbol" char="(" context="shell_in_parenthesis_subcommand"/>
899 <DetectChar attribute="Comment" char="#" context="shell_in_section_comment"/>
900 <StringDetect attribute="Shell commands" String="[[ " context="shell_in_section_cond2"/>
901 <DetectChar attribute="Shell keyword" char="{" context="shell_in_section_brace"/>
902 <IncludeRules context="shell_find_redirections"/>
903 <RegExpr attribute="Shell commands" context="shell_in_section_parameters" String="[^ \t&lt;>|&amp;;()${}'&quot;`\\%#]++"/>
904 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
905 </context>
906
907 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_section_blank_and_ident" fallthroughContext="#pop">
908 <RegExpr attribute="Comment" String="^#|\s+#" context="shell_in_section_comment"/>
909 <RegExpr attribute="Shell keyword" String="(^|\s+)\{&lookahead_whitespace_eol;" context="shell_in_section_brace"/>
910 <IncludeRules context="find_spaces_and_ident"/>
911 </context>
912
913 <!-- sections with { -->
914 <context attribute="Shell commands" lineEndContext="#stay" name="shell_in_section_brace">
915 <DetectChar attribute="Shell keyword" context="#pop" char="}"/>
916 <IncludeRules context="shell in section"/>
917 </context>
918
919 <!-- section with # -->
920 <context attribute="Comment" lineEndContext="#pop" name="shell_in_section_comment">
921 <!-- Warning on single percent ("%"), but not on double percent ("%%"): -->
922 <Detect2Chars attribute="Comment" char="%" char1="%"/>
923 <DetectChar attribute="Warning" char="%"/>
924 <DetectSpaces />
925 <IncludeRules context="##Comments"/> <!-- Alert -->
926 <DetectIdentifier />
927 </context>
928
929 <!-- section with ` -->
930 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_section_bq" fallthroughContext="shell_in_section_parameters">
931 <DetectChar char="`" context="#pop" attribute="Shell symbol"/>
932 <IncludeRules context="shell in section"/>
933 </context>
934
935 <!-- section with cmd ... -->
936 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_section_parameters">
937 <IncludeRules context="shell_in_section_blank_and_ident"/>
938 <AnyChar attribute="Shell symbol" String="&amp;|;" context="#pop"/>
939 <AnyChar attribute="Shell symbol" String="*?"/>
940 <IncludeRules context="shell_in_section_find_variable"/>
941 <DetectChar attribute="Shell string" char="'" context="shell_in_section_sq_string"/>
942 <DetectChar attribute="Shell string" char="&quot;" context="shell_in_section_dq_string"/>
943 <IncludeRules context="shell_find_escape"/>
944 <DetectChar char="`" context="#pop" lookAhead="1"/>
945 <IncludeRules context="shell_find_redirections"/>
946 </context>
947
948 <!-- section with [[ -->
949 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_section_cond2">
950 <Detect2Chars attribute="Shell commands" char="]" char1="]" context="#pop"/>
951 <AnyChar attribute="Shell symbol" String="&amp;|;"/>
952 <IncludeRules context="shell_in_section_parameters"/>
953 </context>
954
955 <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_section_find_variable">
956 <!-- Handle % -->
957 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
958 <Detect2Chars attribute="Shell string" char="$" char1="'" context="shell_in_section_variable_sq"/>
959 <StringDetect attribute="Shell variable" String="$((" context="shell_in_parenthesis_expr"/>
960 <Detect2Chars attribute="Shell symbol" char="$" char1="(" context="shell_in_parenthesis_subcommand"/>
961 <Detect2Chars attribute="Shell variable" char="$" char1="{" context="shell_in_brace_variable_brace"/>
962 <DetectChar attribute="Shell variable" char="$" context="shell_single_variable"/>
963 </context>
964
965 <!-- section with $' -->
966 <context attribute="Shell string" lineEndContext="#pop" name="shell_in_section_variable_sq">
967 <IncludeRules context="find_spaces_and_ident"/>
968 <DetectChar char="'" context="#pop" attribute="Shell string"/>
969 <IncludeRules context="shell_find_escape"/>
970 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
971 </context>
972
973 <!-- section with ' -->
974 <context attribute="Shell string" lineEndContext="#pop" name="shell_in_section_sq_string">
975 <IncludeRules context="find_spaces_and_ident"/>
976 <DetectChar char="'" context="#pop" attribute="Shell string"/>
977 <DetectChar context="handle_percent" char="%" lookAhead="1"/>
978 </context>
979
980 <!-- section with " -->
981 <context attribute="Shell string" lineEndContext="#pop" name="shell_in_section_dq_string">
982 <IncludeRules context="find_spaces_and_ident"/>
983 <DetectChar char="&quot;" context="#pop" attribute="Shell string"/>
984 <IncludeRules context="shell_find_escape"/>
985 <IncludeRules context="shell_in_section_find_variable"/>
986 <DetectChar char="`" context="shell_in_section_bq" attribute="Shell symbol"/>
987 </context>
988
989 </contexts>
990
991 <itemDatas>
992 <!-- "Shell commands" is used for the sections like %prep, %build or %install, where you write
993 shell commands. -->
994 <itemData name="Shell commands" defStyleNum="dsNormal"/>
995 <itemData name="Shell keyword" defStyleNum="dsKeyword"/>
996 <itemData name="Shell string" defStyleNum="dsString"/>
997 <itemData name="Shell variable" defStyleNum="dsVariable"/>
998 <itemData name="Shell symbol" defStyleNum="dsOperator"/>
999 <itemData name="Shell redirection" defStyleNum="dsAttribute"/>
1000 <!-- "Fallback for separator spaces" is used as a fallback context for spaces between
1001 different contexts. For example: "%if 1 <= %number" has the contexts Keyword,
1002 Integer, Keyword and Macro call. But the spaces between? They are using THIS
1003 context. -->
1004 <itemData name="Fallback for separator spaces" defStyleNum="dsNormal"/>
1005 <itemData name="Keyword" defStyleNum="dsKeyword"/>
1006 <itemData name="Control Flow" defStyleNum="dsControlFlow"/>
1007 <itemData name="Comment" defStyleNum="dsComment"/>
1008 <itemData name="Tag" defStyleNum="dsDataType"/>
1009 <!-- "Enumeration" is used for data types where you can't use arbitrary strings but have
1010 to use predefined values (like in "Provides:" or "%undefine"). -->
1011 <itemData name="Enumeration" defStyleNum="dsOthers"/>
1012 <itemData name="String" defStyleNum="dsString"/>
1013 <itemData name="Integer" defStyleNum="dsDecVal"/>
1014 <!-- "Error" is used for problems that will always produce an error in the interpretation
1015 process. -->
1016 <itemData name="Error" defStyleNum="dsError"/>
1017 <!-- "Warning" is used for problems that will maybe produce an error in the interpretation
1018 process or will lead to unexpected results. -->
1019 <itemData name="Warning" defStyleNum="dsError"/>
1020 <!-- "Hint" is used for problems that will never produce an error in the interpretation
1021 process and will always work like expected (the interpreter has error tolerance),
1022 but that are claimed as bad or invalid .spec following the documentation. -->
1023 <itemData name="Hint" defStyleNum="dsError"/>
1024 <itemData name="Macro call" defStyleNum="dsFunction"/>
1025 <itemData name="Section" defStyleNum="dsRegionMarker"/>
1026 <itemData name="Escaped character" defStyleNum="dsChar"/>
1027 <itemData name="Line break" defStyleNum="dsKeyword"/>
1028 </itemDatas>
1029
1030 </highlighting>
1031
1032 <general>
1033 <!-- defining all word deliminators except space and tab as weak -->
1034 <keywords casesensitive="1" weakDeliminator=".():!+,-&lt;=&gt;%&amp;*/;?[]^{|}~\," />
1035 <comments>
1036 <comment name="singleLine" start="#"/>
1037 </comments>
1038 </general>
1039
1040 </language>
1041 <!-- kate: replace-tabs on; tab-width 2; indent-width 2; -->