Warning, /frameworks/syntax-highlighting/data/syntax/rpmspec.xml is written in an unsupported language. File is not indexed.

0001 <?xml version="1.0" encoding="UTF-8"?>
0002 <!DOCTYPE language [
0003   <!ENTITY a_valid_char_in_macro_names "A-Za-z0-9_">
0004   <!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)">
0005   <!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)">
0006   <!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)">
0007   <!ENTITY arch_conditionals_names "(ifarch|ifnarch)">
0008   <!ENTITY os_conditionals_names "(ifos|ifnos)">
0009   <!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;])">
0010   <!ENTITY lookahead_whitespace_eol "(?=($| |\t))">
0011 ]>
0012 <language name="RPM Spec" version="12" kateversion="5.79" section="Other" extensions="*.spec" mimetype="text/x-rpm-spec" license="Public Domain">
0013 
0014 <!-- The entities "arch" and "os" are based on /usr/lib/rpm/rpmrc (in the version coming with openSUSE 11.4). -->
0015 
0016   <highlighting>
0017 
0018     <list name="weekdays">
0019       <item>Mon</item>
0020       <item>Tue</item>
0021       <item>Wed</item>
0022       <item>Thu</item>
0023       <item>Fri</item>
0024       <item>Sat</item>
0025       <item>Sun</item>
0026     </list>
0027 
0028     <list name="month names">
0029       <item>Jan</item>
0030       <item>Feb</item>
0031       <item>Mar</item>
0032       <item>Apr</item>
0033       <item>May</item>
0034       <item>Jun</item>
0035       <item>Jul</item>
0036       <item>Aug</item>
0037       <item>Sep</item>
0038       <item>Oct</item>
0039       <item>Nov</item>
0040       <item>Dec</item>
0041     </list>
0042 
0043     <list name="days">
0044       <item>1</item>
0045       <item>2</item>
0046       <item>3</item>
0047       <item>4</item>
0048       <item>5</item>
0049       <item>6</item>
0050       <item>7</item>
0051       <item>8</item>
0052       <item>9</item>
0053       <item>01</item>
0054       <item>02</item>
0055       <item>03</item>
0056       <item>04</item>
0057       <item>05</item>
0058       <item>06</item>
0059       <item>07</item>
0060       <item>08</item>
0061       <item>09</item>
0062       <item>10</item>
0063       <item>11</item>
0064       <item>12</item>
0065       <item>13</item>
0066       <item>14</item>
0067       <item>15</item>
0068       <item>16</item>
0069       <item>17</item>
0070       <item>18</item>
0071       <item>19</item>
0072       <item>20</item>
0073       <item>21</item>
0074       <item>22</item>
0075       <item>23</item>
0076       <item>24</item>
0077       <item>25</item>
0078       <item>26</item>
0079       <item>27</item>
0080       <item>28</item>
0081       <item>29</item>
0082       <item>30</item>
0083       <item>31</item>
0084     </list>
0085 
0086     <list name="bash_keyword">
0087       <item>break</item>
0088       <item>case</item>
0089       <item>continue</item>
0090       <item>do</item>
0091       <item>done</item>
0092       <item>elif</item>
0093       <item>else</item>
0094       <item>esac</item>
0095       <item>fi</item>
0096       <item>for</item>
0097       <item>function</item>
0098       <item>if</item>
0099       <item>in</item>
0100       <item>return</item>
0101       <item>select</item>
0102       <item>then</item>
0103       <item>until</item>
0104       <item>while</item>
0105     </list>
0106 
0107     <contexts>
0108       <!-- "package section" is the context for the package definition. As it is the first context
0109       in this file, it is also the context with which the interpreter starts. -->
0110       <context attribute="Error" lineEndContext="#stay" name="package section">
0111         <!-- Handle % -->
0112         <DetectChar context="macro entry in package section" char="%" lookAhead="true" />
0113         <!-- Handle tags: -->
0114         <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"/>
0115         <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"/>
0116         <RegExpr attribute="Tag" context="tag_line_string_only_one_word" String="^(Name|Version|Release|Url|URL)[ \t]*:[ \t]*" column="0"/>
0117         <RegExpr attribute="Tag" context="tag_line_os" String="^(ExclusiveOs|ExcludeOs)[ \t]*:[ \t]*" column="0"/>
0118         <RegExpr attribute="Tag" context="tag_line_arch" String="^(BuildArch|BuildArchitectures|ExclusiveArch|ExcludeArch)[ \t]*:[ \t]*" column="0"/>
0119         <RegExpr attribute="Tag" context="tag_line_integer" String="^(Epoch|Serial|Nosource|Nopatch)[ \t]*:[ \t]*" column="0"/>
0120         <RegExpr attribute="Tag" context="tag_line_switch" String="^(AutoReq|AutoProv|AutoReqProv)[ \t]*:[ \t]*" column="0"/>
0121         <RegExpr attribute="Tag" context="tag_line_value" String="^(Icon)[ \t]*:[ \t]*" column="0"/>
0122         <!-- Handle comments. "# norootforbuild" is displayed like a tag. -->
0123         <RegExpr context="Comment" String="^[ \t]*#" column="0" lookAhead="true" />
0124         <!-- Spaces are okay -->
0125         <DetectSpaces attribute="Fallback for separator spaces" />
0126         <DetectIdentifier/>
0127         <!-- Fallback value for every non-space -->
0128         <!--RegExpr attribute="Error" context="#stay" String="[^\s]" /-->
0129       </context>
0130 
0131       <!-- "macro entry in package section" is used for lines in the package section that start
0132       with a macro. It recognizes macros. Everything else is treated as normal text. This context
0133       is used to prevent to highlight syntax errors after macros. With the next line break, this
0134       context will switch back ("#pop"). -->
0135       <context attribute="Shell commands" lineEndContext="#pop" name="macro entry in package section">
0136         <!-- Handle % -->
0137         <DetectChar context="handle_percent" char="%" lookAhead="true" />
0138         <IncludeRules context="find_spaces_and_ident"/>
0139       </context>
0140 
0141       <!-- "package section start line" simply is used for the parameters after the
0142       "%package" macro. With the next line break, it will switch to the
0143       "package section" context which will handle everything else. -->
0144       <context attribute="Shell commands" lineEndContext="package section" name="package section start line">
0145         <!-- Handle % -->
0146         <DetectChar context="handle_percent" char="%" lookAhead="true" />
0147       </context>
0148 
0149       <!-- "command section" is a generic context for all sections (like %prep, %build, %install...)
0150       where you can enter shell commands. -->
0151       <context attribute="Shell commands" lineEndContext="#stay" name="command section" fallthroughContext="#pop!shell in section">
0152         <RegExpr attribute="Shell commands" String="\s+(?=.*-p\s+&lt;lua>)" context="#pop!command section lua"/>
0153       </context>
0154       <context attribute="Shell commands" lineEndContext="#pop!section lua" name="command section lua">
0155         <DetectChar context="handle_percent" char="%" lookAhead="true" />
0156         <IncludeRules context="find_spaces_and_ident"/>
0157       </context>
0158       <context attribute="Shell commands" lineEndContext="#stay" name="section lua">
0159         <DetectChar context="handle_percent" char="%" lookAhead="1" column="0"/>
0160         <IncludeRules context="##Lua"/>
0161       </context>
0162 
0163       <!-- "changelog section" is the context for the changelog. By default, everything that is
0164       not recognized especially, is interpretated as changelog text. -->
0165       <context attribute="String" lineEndContext="#stay" name="changelog section">
0166         <!-- Handle calender date -->
0167         <DetectChar attribute="Tag" context="changelog_weekday" char="*" column="0" />
0168         <IncludeRules context="description section"/>
0169       </context>
0170 
0171       <!-- "description section start line" simply is used for the parameters after the
0172       "%description" macro. With the next line break, it will switch to the
0173       "description section" context which will handle the content of the description. -->
0174       <context attribute="Shell commands" lineEndContext="#pop!description section" name="description section start line">
0175         <!-- Handle % -->
0176         <DetectChar context="handle_percent" char="%" lookAhead="true" />
0177       </context>
0178 
0179       <!-- "description section" is a follow-up context of "description section start line". See
0180       there for further details. -->
0181       <context attribute="String" lineEndContext="#stay" name="description section">
0182         <!-- Handle % -->
0183         <DetectChar context="handle_percent" char="%" lookAhead="true" />
0184         <DetectIdentifier attribute="String"/>
0185         <!-- Handle comments. "# norootforbuild" is displayed like a tag. -->
0186         <RegExpr context="Comment" String="^[ \t]*#" column="0" lookAhead="true" />
0187         <DetectSpaces attribute="String"/>
0188       </context>
0189 
0190       <!-- This is a convenience context that is handling comments automatically. Furthermore it
0191       handles "# norootforbuild" because it looks like a comment. If a context supports comments,
0192       simple use "<RegExpr context="Comment" String="^[ \t]*#" column="0" lookAhead="true" />".
0193       (This context relies on the asumption that # is the first non-whitespace. We have to
0194       guarantee this when calling this context! -->
0195       <context attribute="Comment" lineEndContext="#pop" name="Comment">
0196         <!-- While indeeted comments are not allowed by the standard (see section "Comments" at
0197         http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch-specfile-syntax.html#id1961462),
0198         rpmbuild accepts them nevertheless. We highlight them as comments, but we mark the
0199         indeet. -->
0200         <!-- Handle "# norootforbuild" and some of its miss-spellings. -->
0201         <StringDetect attribute="Tag" context="every_non_whitespace_is_warning" String="# norootforbuild" column="0" />
0202         <RegExpr attribute="Warning" context="#stay" String="#[ \t]*norootforbuild" firstNonSpace="1"/>
0203         <RegExpr attribute="Hint" context="#stay" String="^[ \t]+(?=#)" column="0" />
0204         <!-- Warning on single percent ("%"), but not on double percent ("%%"): -->
0205         <Detect2Chars attribute="Comment" char="%" char1="%"/>
0206         <DetectChar attribute="Warning" char="%"/>
0207         <DetectSpaces />
0208         <IncludeRules context="##Comments"/> <!-- Alert -->
0209         <DetectIdentifier />
0210       </context>
0211 
0212       <!-- "every_non_whitespace_is_error" is a simple helper context. It switchs back to the
0213       previous context at the end of the line. -->
0214       <context attribute="Fallback for separator spaces" lineEndContext="#pop" name="every_non_whitespace_is_error">
0215         <DetectSpaces attribute="Fallback for separator spaces"/>
0216         <RegExpr attribute="Error" context="#stay" String="[^\s]+"/>
0217       </context>
0218 
0219       <!-- "every_non_whitespace_is_warning" is a simple helper context. It switchs back to the
0220       previous context at the end of the line. -->
0221       <context attribute="Fallback for separator spaces" lineEndContext="#pop" name="every_non_whitespace_is_warning">
0222         <RegExpr attribute="Warning" context="#stay" String="[^\s]" />
0223       </context>
0224 
0225       <!-- "tag_line_value" is a context for enumeration values. It makes no further syntax
0226       check. -->
0227       <context attribute="Enumeration" lineEndContext="#pop" name="tag_line_value">
0228         <!-- Handle % -->
0229         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0230       </context>
0231 
0232       <!-- "tag_line_string" is a context for string values. It makes no further syntax
0233       check. -->
0234       <context attribute="String" lineEndContext="#pop" name="tag_line_string">
0235         <!-- Handle \ -->
0236         <RegExpr attribute="Escaped character" String="\\[^%]|\\(?=(\%))" />
0237         <!-- Handle % -->
0238         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0239       </context>
0240 
0241       <!-- "tag_line_string_only_one_word" is a context for string values. The first word is
0242       highlighted as string, but after the first space (normal space, tab...), all other
0243       words are highlighted as error. WARNING: This context requieres that there is no space at
0244       the begin! -->
0245       <context attribute="String" lineEndContext="#pop" name="tag_line_string_only_one_word">
0246         <!-- Handle \ -->
0247         <RegExpr attribute="Escaped character" String="\\[^%]|\\(?=(\%))" />
0248         <!-- Handle % -->
0249         <AnyChar context="tag_line_string" String="%$" lookAhead="true" />
0250         <!-- Handle spaces -->
0251         <DetectSpaces context="every_non_whitespace_is_error" />
0252       </context>
0253 
0254       <!-- "tag_line_integer" is a context for integer values. Non-integer context is marked as
0255       error. -->
0256       <context attribute="Error" lineEndContext="#pop" name="tag_line_integer" fallthroughContext="every_non_whitespace_is_error">
0257         <Int attribute="Integer" context="every_non_whitespace_is_error" />
0258         <!-- Handle % -->
0259         <AnyChar context="tag_line_integer_without_syntax_check" String="%$" lookAhead="true" />
0260       </context>
0261 
0262       <!-- "tag_line_os" is a context for values that define the operation system. Unknown values
0263       are marked as error. -->
0264       <context attribute="Warning" lineEndContext="#pop" name="tag_line_os">
0265         <!-- Spaces are okay -->
0266         <DetectSpaces attribute="Fallback for separator spaces" />
0267         <!-- Recognize valid values -->
0268         <RegExpr attribute="Enumeration" String="&os;&lookahead_whitespace_eol;" />
0269         <!-- Handle % -->
0270         <AnyChar context="tag_line_value" String="%$" lookAhead="true" />
0271       </context>
0272 
0273       <!-- "tag_line_integer_without_syntax_check" is a context that is used internally by
0274       "tag_line_integer" after macros. -->
0275       <context attribute="Integer" lineEndContext="#pop" name="tag_line_integer_without_syntax_check">
0276         <!-- Handle % -->
0277         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0278       </context>
0279 
0280       <!-- "tag_line_arch" is a context for values that define the computer type. Unknown values
0281       are marked as error. -->
0282       <context attribute="Warning" lineEndContext="#pop" name="tag_line_arch">
0283         <!-- Spaces are okay -->
0284         <DetectSpaces attribute="Fallback for separator spaces" />
0285         <!-- Recognize valid values -->
0286         <RegExpr attribute="Enumeration" String="&arch;&lookahead_whitespace_eol;" />
0287         <!-- Handle % -->
0288         <AnyChar context="tag_line_value" String="%$" lookAhead="true" />
0289       </context>
0290 
0291       <!-- "tag_line_package" is a context for dependency handling. The keywords <= >= == < > are
0292       recognized and highlighted as keywords. Thee rest is simply highlighted as enumeration. See
0293       http://docs.fedoraproject.org/drafts/rpm-guide-en/ch-specfile-syntax.html#id3045258 and
0294       http://docs.fedoraproject.org/drafts/rpm-guide-en/ch-advanced-packaging.html#id2979270 for
0295       details -->
0296       <context attribute="Enumeration" lineEndContext="#pop" name="tag_line_package">
0297         <AnyChar attribute="Keyword" context="#stay" String="()" /> <!-- See http://rpm5.org/docs/api/dependencies.html about the parentheses -->
0298         <Detect2Chars attribute="Keyword" context="#stay" char="&lt;" char1="="/>
0299         <Detect2Chars attribute="Keyword" context="#stay" char="&gt;" char1="="/>
0300         <Detect2Chars attribute="Keyword" context="#stay" char="=" char1="="/>
0301         <AnyChar attribute="Keyword" context="#stay" String="=&lt;&gt;," />
0302         <!-- Handle % -->
0303         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0304       </context>
0305 
0306       <!-- "tag_line_switch" is a context that accepts "0", "1", "yes" and "no" as value.
0307       Everything else is an error. See http://www.rpm.org/max-rpm-snapshot/s1-rpm-depend-auto-depend.html
0308       and http://www.rpm.org/max-rpm/s1-rpm-inside-tags.html#S3-RPM-INSIDE-AUTOREQPROV-TAG -->
0309       <context attribute="Error" lineEndContext="#pop" name="tag_line_switch" fallthroughContext="every_non_whitespace_is_error">
0310         <AnyChar attribute="Enumeration" context="every_non_whitespace_is_error" String="01" />
0311         <Detect2Chars attribute="Enumeration" context="every_non_whitespace_is_error" char="n" char1="o"/>
0312         <StringDetect attribute="Enumeration" context="every_non_whitespace_is_error" String="yes" />
0313         <!-- Handle % -->
0314         <AnyChar context="tag_line_value" String="%$" lookAhead="true" />
0315       </context>
0316 
0317       <!-- A context that doesn't test for format errors in the changelog date anymore. Necessary
0318       if macros are used. -->
0319       <context attribute="Tag" lineEndContext="#pop" name="changelog_generic">
0320         <!-- Handle % -->
0321         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0322       </context>
0323 
0324      <!-- A context that handles the weekday in the changelog date. -->
0325       <context attribute="Tag" lineEndContext="#pop" name="changelog_weekday">
0326         <DetectSpaces/>
0327         <keyword context="changelog_month" attribute="Tag" String="weekdays" />
0328         <!-- % handling without format errors in the date of the changelog -->
0329         <AnyChar context="changelog_generic" String="%$" lookAhead="true" />
0330         <RegExpr context="changelog_month" attribute="Error" String="\S*" />
0331       </context>
0332 
0333      <!-- A context that handles the month in the changelog date. -->
0334       <context attribute="Tag" lineEndContext="#pop" name="changelog_month">
0335         <DetectSpaces/>
0336         <keyword context="changelog_day" attribute="Tag" String="month names" />
0337         <!-- % handling without format errors in the date of the changelog -->
0338         <AnyChar context="changelog_generic" String="%$" lookAhead="true" />
0339         <RegExpr context="changelog_day" attribute="Error" String="\S*" />
0340       </context>
0341 
0342      <!-- A context that handles the day in the changelog date. -->
0343       <context attribute="Tag" lineEndContext="#pop" name="changelog_day">
0344         <DetectSpaces/>
0345         <keyword context="changelog_year" attribute="Tag" String="days" />
0346         <!-- % handling without format errors in the date of the changelog -->
0347         <AnyChar context="changelog_generic" String="%$" lookAhead="true" />
0348         <RegExpr context="changelog_year" attribute="Error" String="\S*" />
0349       </context>
0350 
0351      <!-- A context that handles the year in the changelog date. -->
0352       <context attribute="Tag" lineEndContext="#pop" name="changelog_year">
0353         <DetectSpaces/>
0354         <RegExpr context="changelog_header" attribute="Tag" String="(\d{4})&lookahead_whitespace_eol;" />
0355         <!-- % handling without format errors in the date of the changelog -->
0356         <AnyChar context="changelog_generic" String="%$" lookAhead="true" />
0357         <RegExpr context="changelog_header" attribute="Error" String="\S*" />
0358       </context>
0359 
0360      <!-- A context that handles the text after the date in a changelog (name, e-mail...). -->
0361       <context attribute="Tag" lineEndContext="#pop" name="changelog_header">
0362         <!-- Handle % -->
0363         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0364       </context>
0365 
0366       <!-- Handles everything that comes after %ifos etc... -->
0367       <context attribute="Warning" lineEndContext="#pop" name="parameters after ifos">
0368         <!-- Spaces are okay -->
0369         <DetectSpaces attribute="Fallback for separator spaces" />
0370         <!-- Recognize valid values -->
0371         <RegExpr attribute="Enumeration" String="&os;&lookahead_whitespace_eol;" />
0372         <!-- Handle % -->
0373         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0374       </context>
0375 
0376       <!-- Handles everything that comes after %ifarch etc... -->
0377       <context attribute="Warning" lineEndContext="#pop" name="parameters after ifarch">
0378         <!-- Spaces are okay -->
0379         <DetectSpaces attribute="Fallback for separator spaces" />
0380         <!-- Recognize valid values -->
0381         <RegExpr attribute="Enumeration" String="&arch;&lookahead_whitespace_eol;" />
0382         <!-- Handle % -->
0383         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0384       </context>
0385 
0386       <!-- Handles expressions after conditionals. -->
0387       <context attribute="Error" lineEndContext="#pop" name="expression after _if_ statement">
0388         <!-- spaces should not be "Error" (which is the default for unrecognized entities) -->
0389         <DetectSpaces attribute="Fallback for separator spaces" context="#stay" />
0390         <!-- %if recognizes && || > < >= <= == != ! and () -->
0391         <AnyChar attribute="Keyword" context="#stay" String="()" />
0392         <Detect2Chars attribute="Keyword" context="#stay" char="&amp;" char1="&amp;"/>
0393         <Detect2Chars attribute="Keyword" context="#stay" char="&lt;" char1="="/>
0394         <Detect2Chars attribute="Keyword" context="#stay" char="&gt;" char1="="/>
0395         <Detect2Chars attribute="Keyword" context="#stay" char="=" char1="="/>
0396         <Detect2Chars attribute="Keyword" context="#stay" char="!" char1="="/>
0397         <AnyChar attribute="Keyword" context="#stay" String="!&lt;&gt;" />
0398         <Detect2Chars attribute="Keyword" context="#stay" char="|" char1="|"/>
0399         <!-- %if interpretates values either as integer or as string -->
0400         <Int attribute="Integer" context="#stay" additionalDeliminator="!("/>
0401         <DetectIdentifier attribute="String" context="#stay" />
0402         <DetectChar attribute="String" context="quoted strings in if statements" char="&quot;" />
0403         <!-- Handle % -->
0404         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0405       </context>
0406 
0407       <!-- This context handles quoted strings in %if statements. WARNING: Make sure that you
0408       switch to this context _after_ parsing the starting ", because at the first occurrence
0409       of " this context switches back. -->
0410       <context attribute="String" lineEndContext="#pop" name="quoted strings in if statements">
0411         <!-- Handle \ -->
0412         <RegExpr attribute="Escaped character" String="\\[^&quot;]" />
0413         <!-- Handle % -->
0414         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0415         <!-- Switch back at the end of the quoted string -->
0416         <DetectChar attribute="String" context="#pop" char="&quot;" />
0417       </context>
0418 
0419       <!-- Context for %define -->
0420       <context attribute="Fallback for separator spaces" lineEndContext="#pop" name="macro definition">
0421         <DetectSpaces />
0422         <RegExpr attribute="Enumeration" context="macro definition content" String="[&a_valid_char_in_macro_names;]*(([(][)])|&lookahead_whitespace_eol;)" />
0423         <RegExpr attribute="Error" context="macro definition content" String="[^ \t]*" />
0424       </context>
0425 
0426       <!-- Context for the content of a macro definition. -->
0427       <context attribute="String" lineEndContext="#pop" name="macro definition content">
0428         <IncludeRules context="find_spaces_and_ident"/>
0429         <!-- Handle % -->
0430         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0431         <LineContinue attribute="Line break" context="#stay"/>
0432         <DetectChar attribute="Warning" char="\" />
0433       </context>
0434 
0435       <!-- Context for %undefine -->
0436       <context attribute="Fallback for separator spaces" lineEndContext="#pop" name="undefine macro">
0437         <DetectSpaces />
0438         <RegExpr attribute="Enumeration" context="every_non_whitespace_is_error" String="[&a_valid_char_in_macro_names;]*&lookahead_whitespace_eol;" />
0439         <RegExpr attribute="Error" context="every_non_whitespace_is_error" String="." />
0440       </context>
0441 
0442       <!-- This context handles automatically all type of macros, keywords and so on that start with % or $.
0443       It expects a string starting with % or $ (otherwise, this context will fail!). -->
0444       <context attribute="Fallback for separator spaces" lineEndContext="#pop" name="handle_percent">
0445         <Detect2Chars attribute="Escaped character" context="#pop" char="%" char1="%"/>
0446         <!-- Handle normal macros -->
0447         <Detect2Chars attribute="Macro call" context="#pop!macro content in braces" char="%" char1="{" />
0448         <Detect2Chars attribute="Macro call" context="#pop!macro content in parenthesis" char="%" char1="(" />
0449         <!-- Keywords: -->
0450         <RegExpr attribute="Control Flow" context="expression after _if_ statement" String="%(if!?)&lookahead_whitespace_eol;" firstNonSpace="true" beginRegion="if_block" />
0451         <RegExpr attribute="Control Flow" context="parameters after ifarch" String="%&arch_conditionals_names;&lookahead_whitespace_eol;" firstNonSpace="true" beginRegion="if_block" />
0452         <RegExpr attribute="Control Flow" context="parameters after ifos" String="%&os_conditionals_names;&lookahead_whitespace_eol;" firstNonSpace="true" beginRegion="if_block" />
0453         <RegExpr attribute="Control Flow" context="every_non_whitespace_is_error" String="%else&lookahead_whitespace_eol;" firstNonSpace="true" endRegion="if_block" beginRegion="if_block" />
0454         <RegExpr attribute="Control Flow" context="every_non_whitespace_is_error" String="%endif&lookahead_whitespace_eol;" firstNonSpace="true" endRegion="if_block" />
0455         <RegExpr attribute="Keyword" context="macro definition" String="%(define|global)&lookahead_whitespace_eol;" firstNonSpace="true" />
0456         <RegExpr attribute="Keyword" context="undefine macro" String="%undefine&lookahead_whitespace_eol;" firstNonSpace="true" />
0457         <!-- If a command section starts (=section macro at begin of the line), we switch
0458              to the corresponding context. There will never be a return to THIS context...: -->
0459         <RegExpr attribute="Section" context="#pop#pop!package section start line" String="^%package&lookahead_whitespace_eol;" column="0" />
0460         <RegExpr attribute="Section" context="#pop#pop!description section start line" String="^%description&lookahead_whitespace_eol;" column="0" />
0461         <RegExpr attribute="Section" context="#pop#pop!command section" String="^%&command_section_name;&lookahead_whitespace_eol;" column="0" />
0462         <RegExpr attribute="Section" context="#pop#pop!changelog section" String="^%changelog&lookahead_whitespace_eol;" column="0" />
0463         <!-- Handle normal macros -->
0464         <RegExpr attribute="Macro call" context="macro call in parenthesis" String="%(?!&predefined_commands;)[&a_valid_char_in_macro_names;]*\(" />
0465         <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. -->
0466         <RegExpr attribute="Error" context="#pop" String="%([&a_valid_char_in_macro_names;]+|[*#])?" /> <!-- a single % or $ is also an error -->
0467       </context>
0468 
0469       <!-- Used internally by "handle_percent" -->
0470       <context attribute="Macro call" lineEndContext="#pop" name="normal macro content in braces">
0471         <DetectChar attribute="Macro call" context="#pop" char="}" />
0472         <DetectIdentifier attribute="Macro call"/>
0473         <AnyChar attribute="Error" context="#stay" String="({)" />
0474         <!--(This seems to be confusing instead of helping)AnyChar attribute="Keyword" context="#stay" String="!?:" /-->
0475         <!-- Handle % -->
0476         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0477         <DetectSpaces attribute="Macro call"/>
0478       </context>
0479 
0480       <context attribute="Shell commands" lineEndContext="#stay" name="macro_lua">
0481         <DetectChar attribute="Macro call" context="#pop" char="}" />
0482         <!-- Should exit on the first } found, even if this one is in a string,
0483         but this is currently not possible -->
0484         <IncludeRules context="##Lua"/>
0485       </context>
0486 
0487       <!-- Used internally by "handle_percent"
0488       Context for %{  -->
0489       <context attribute="Macro call" lineEndContext="#pop" name="macro content in braces" fallthroughContext="#pop!normal macro content in braces">
0490         <StringDetect attribute="Macro call" context="#pop!macro_expand" String="expand:"/>
0491         <StringDetect attribute="Macro call" context="#pop!macro_lua" String="lua:"/>
0492       </context>
0493 
0494       <!-- Used internally by "handle_percent"
0495       Context for %xxx(  -->
0496       <context attribute="Macro call" lineEndContext="#pop#pop" name="macro call in parenthesis">
0497         <DetectChar attribute="Macro call" context="#pop#pop" char=")" />
0498         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0499         <DetectIdentifier attribute="Macro call"/>
0500       </context>
0501 
0502       <!-- Used internally by "handle_percent"
0503       Context for %( -->
0504       <context attribute="Shell commands" lineEndContext="#stay" name="macro content in parenthesis" fallthroughContext="shell_in_parenthesis_parameters">
0505         <DetectChar attribute="Macro call" context="#pop" char=")"/>
0506         <keyword attribute="Shell keyword" String="bash_keyword" additionalDeliminator="&amp;|);"/>
0507         <DetectIdentifier attribute="Shell commands" context="shell_in_parenthesis_parameters"/>
0508         <DetectSpaces attribute="Shell commands"/>
0509         <AnyChar attribute="Shell symbol" String="&amp;|;!"/>
0510         <DetectChar char="`" context="shell_in_parenthesis_bq" attribute="Shell symbol"/>
0511         <Detect2Chars attribute="Shell variable" char="(" char1="(" context="shell_in_parenthesis_expr"/>
0512         <DetectChar attribute="Shell symbol" char="(" context="shell_in_parenthesis_subcommand"/>
0513         <DetectChar attribute="Comment" char="#" context="shell_in_parenthesis_comment"/>
0514         <StringDetect attribute="Shell commands" String="[[ " context="shell_in_parenthesis_cond2"/>
0515         <DetectChar attribute="Shell keyword" char="{" context="shell_in_parenthesis_brace"/>
0516         <IncludeRules context="shell_find_redirections"/>
0517         <RegExpr attribute="Shell commands" context="shell_in_parenthesis_parameters" String="[^ \t&lt;>|&amp;;()${}'&quot;`\\%#]++"/>
0518       </context>
0519 
0520       <context attribute="Shell commands" lineEndContext="#pop" name="find_spaces_and_ident">
0521         <DetectSpaces/>
0522         <DetectIdentifier/>
0523       </context>
0524 
0525       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_parenthesis_find_blank_and_ident" fallthroughContext="#pop">
0526         <RegExpr attribute="Comment" String="^#|\s+#" context="shell_in_parenthesis_comment"/>
0527         <RegExpr attribute="Shell keyword" String="(^|\s+)\{&lookahead_whitespace_eol;" context="shell_in_parenthesis_brace"/>
0528         <IncludeRules context="find_spaces_and_ident"/>
0529       </context>
0530 
0531       <!-- %( with { -->
0532       <context attribute="Shell commands" lineEndContext="#stay" name="shell_in_parenthesis_brace">
0533         <DetectChar attribute="Shell keyword" context="#pop" char="}"/>
0534         <DetectChar context="#pop" char=")" lookAhead="1"/>
0535         <IncludeRules context="macro content in parenthesis"/>
0536       </context>
0537 
0538       <!-- %( with # -->
0539       <context attribute="Comment" lineEndContext="#pop" name="shell_in_parenthesis_comment">
0540         <DetectChar attribute="Comment" char="(" context="shell_in_parenthesis_comment_brace"/>
0541         <DetectChar char=")" context="#pop" lookAhead="1"/>
0542         <IncludeRules context="shell_in_section_comment"/>
0543       </context>
0544       <context attribute="Comment" lineEndContext="#pop" name="shell_in_parenthesis_comment_brace">
0545         <DetectChar attribute="Comment" char=")" context="#pop"/>
0546         <IncludeRules context="shell_in_parenthesis_comment"/>
0547       </context>
0548 
0549       <!-- %( with ` -->
0550       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_parenthesis_bq" fallthroughContext="shell_in_parenthesis_parameters">
0551         <DetectChar char="`" context="#pop" attribute="Shell symbol"/>
0552         <DetectChar char=")" context="#pop" lookAhead="1"/>
0553         <IncludeRules context="macro content in parenthesis"/>
0554       </context>
0555 
0556       <!-- %( with cmd ... -->
0557       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_parenthesis_parameters">
0558         <IncludeRules context="shell_in_parenthesis_find_blank_and_ident"/>
0559         <AnyChar context="#pop" String=")`" lookAhead="1"/>
0560         <AnyChar attribute="Shell symbol" String="&amp;|;" context="#pop"/>
0561         <AnyChar attribute="Shell symbol" String="*?"/>
0562         <DetectChar attribute="Shell commands" context="shell_in_parenthesis_parameters_brace" char="("/>
0563         <IncludeRules context="shell_in_parenthesis_find_word"/>
0564         <IncludeRules context="shell_find_redirections"/>
0565       </context>
0566       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_parenthesis_parameters_brace">
0567         <DetectChar attribute="Shell commands" context="#pop" char=")"/>
0568         <AnyChar String="&amp;|;" context="#pop" lookAhead="1"/>
0569         <IncludeRules context="shell_in_parenthesis_parameters"/>
0570       </context>
0571 
0572       <!-- %( with [[ -->
0573       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_parenthesis_cond2">
0574         <Detect2Chars attribute="Shell commands" char="]" char1="]" context="#pop"/>
0575         <AnyChar attribute="Shell symbol" String="&amp;|;"/>
0576         <DetectChar attribute="Shell symbol" char="(" context="shell_in_parenthesis_sub_cond2"/>
0577         <IncludeRules context="shell_in_parenthesis_parameters"/>
0578       </context>
0579       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_parenthesis_sub_cond2">
0580         <DetectChar attribute="Shell symbol" char=")" context="#pop"/>
0581         <AnyChar attribute="Shell symbol" String="&amp;|;"/>
0582         <DetectChar attribute="Shell symbol" char="(" context="shell_in_parenthesis_sub_cond2"/>
0583         <Detect2Chars char="]" char1="]" context="#pop" lookAhead="1"/>
0584         <IncludeRules context="shell_in_parenthesis_parameters"/>
0585       </context>
0586 
0587       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_parenthesis_find_word" fallthroughContext="#pop">
0588         <IncludeRules context="shell_in_parenthesis_find_variable"/>
0589         <DetectChar attribute="Shell string" char="'" context="shell_in_parenthesis_sq_string"/>
0590         <DetectChar attribute="Shell string" char="&quot;" context="shell_in_parenthesis_dq_string"/>
0591         <IncludeRules context="shell_find_escape"/>
0592         <DetectChar char="`" context="#pop" lookAhead="1"/>
0593       </context>
0594 
0595       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_parenthesis_find_variable">
0596         <!-- Handle % -->
0597         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0598         <Detect2Chars attribute="Shell string" char="$" char1="'" context="shell_in_parenthesis_variable_sq"/>
0599         <StringDetect attribute="Shell variable" String="$((" context="shell_in_parenthesis_expr"/>
0600         <Detect2Chars attribute="Shell symbol" char="$" char1="(" context="shell_in_parenthesis_subcommand"/>
0601         <Detect2Chars attribute="Shell variable" char="$" char1="{" context="shell_in_parenthesis_variable_brace"/>
0602         <DetectChar attribute="Shell variable" char="$" context="shell_single_variable"/>
0603       </context>
0604 
0605       <!-- %( with $' -->
0606       <context attribute="Shell string" lineEndContext="#pop" name="shell_in_parenthesis_variable_sq">
0607         <IncludeRules context="find_spaces_and_ident"/>
0608         <DetectChar char="'" context="#pop" attribute="Shell string"/>
0609         <DetectChar char=")" context="#pop" lookAhead="1"/>
0610         <DetectChar char="(" context="shell_in_parenthesis_variable_sq_brace" attribute="Shell string"/>
0611         <IncludeRules context="shell_find_escape"/>
0612         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0613       </context>
0614       <context attribute="Shell string" lineEndContext="#pop" name="shell_in_parenthesis_variable_sq_brace">
0615         <DetectChar char="'" context="#pop" lookAhead="1"/>
0616         <DetectChar char=")" context="#pop" attribute="Shell string"/>
0617         <IncludeRules context="shell_in_parenthesis_variable_sq"/>
0618       </context>
0619 
0620       <!-- %( with $(( -->
0621       <context attribute="Shell variable" lineEndContext="#pop" name="shell_in_parenthesis_expr">
0622         <IncludeRules context="shell_in_parenthesis_find_blank_and_ident"/>
0623         <Detect2Chars char=")" char1=")" context="#pop" attribute="Shell variable"/>
0624         <DetectChar char=")" context="#pop!shell_in_parenthesis_subcommand" attribute="Shell variable"/>
0625         <DetectChar char="(" context="shell_in_parenthesis_subexpr" attribute="Shell symbol"/>
0626         <IncludeRules context="shell_in_parenthesis_find_word"/>
0627       </context>
0628       <context attribute="Shell variable" lineEndContext="#pop" name="shell_in_parenthesis_subexpr">
0629         <IncludeRules context="shell_in_parenthesis_find_blank_and_ident"/>
0630         <DetectChar char=")" context="#pop" attribute="Shell symbol"/>
0631         <DetectChar char="(" context="shell_in_parenthesis_subexpr" attribute="Shell symbol"/>
0632         <IncludeRules context="shell_in_parenthesis_find_word"/>
0633       </context>
0634 
0635       <!-- %( with $( -->
0636       <context attribute="Shell string" lineEndContext="#pop" name="shell_in_parenthesis_subcommand">
0637         <DetectChar char=")" context="#pop" attribute="Shell symbol"/>
0638         <IncludeRules context="macro content in parenthesis"/>
0639       </context>
0640 
0641       <!-- %( with ${ -->
0642       <context attribute="Shell variable" lineEndContext="#pop" name="shell_in_parenthesis_variable_brace">
0643         <DetectChar char=")" context="#pop" lookAhead="1"/>
0644         <DetectChar char="(" context="shell_in_parenthesis_variable_brace_parenthesis" attribute="Shell variable"/>
0645         <DetectChar attribute="Shell variable" char="}" context="#pop"/>
0646         <DetectChar attribute="Shell variable" char="{" context="shell_in_parenthesis_variable_brace"/>
0647         <DetectIdentifier attribute="Shell variable"/>
0648         <IncludeRules context="shell_in_parenthesis_find_word"/>
0649       </context>
0650       <context attribute="Shell variable" lineEndContext="#pop" name="shell_in_parenthesis_variable_brace_parenthesis">
0651         <DetectChar char=")" context="#pop" attribute="Shell variable"/>
0652         <IncludeRules context="shell_in_parenthesis_variable_brace"/>
0653       </context>
0654 
0655       <!-- %( with ' -->
0656       <context attribute="Shell string" lineEndContext="#pop" name="shell_in_parenthesis_sq_string">
0657         <IncludeRules context="find_spaces_and_ident"/>
0658         <DetectChar char=")" context="#pop" lookAhead="1"/>
0659         <DetectChar char="'" context="#pop" attribute="Shell string"/>
0660         <DetectChar char="(" context="shell_in_parenthesis_sq_string_brace" attribute="Shell string"/>
0661         <Detect2Chars char="\" char1=")" attribute="Escaped character"/>
0662         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0663       </context>
0664       <context attribute="Shell string" lineEndContext="#pop" name="shell_in_parenthesis_sq_string_brace">
0665         <DetectChar char=")" context="#pop" attribute="Shell string"/>
0666         <DetectChar char="'" context="#pop" lookAhead="1"/>
0667         <IncludeRules context="shell_in_parenthesis_sq_string"/>
0668       </context>
0669 
0670       <!-- %( with " -->
0671       <context attribute="Shell string" lineEndContext="#pop" name="shell_in_parenthesis_dq_string">
0672         <IncludeRules context="find_spaces_and_ident"/>
0673         <DetectChar char="&quot;" context="#pop" attribute="Shell string"/>
0674         <DetectChar char=")" context="#pop" lookAhead="1"/>
0675         <DetectChar char="(" context="shell_in_parenthesis_dq_string_brace" attribute="Shell string"/>
0676         <IncludeRules context="shell_find_escape"/>
0677         <IncludeRules context="shell_in_parenthesis_find_variable"/>
0678         <DetectChar char="`" context="shell_in_parenthesis_bq" attribute="Shell symbol"/>
0679       </context>
0680       <context attribute="Shell string" lineEndContext="#pop" name="shell_in_parenthesis_dq_string_brace">
0681         <DetectChar char="&quot;" context="#pop" lookAhead="1"/>
0682         <DetectChar char=")" context="#pop" attribute="Shell string"/>
0683         <IncludeRules context="shell_in_parenthesis_dq_string"/>
0684       </context>
0685 
0686 
0687       <!-- Used internally by "handle_percent"
0688       Context for %{expand: -->
0689       <context attribute="Shell commands" lineEndContext="#stay" name="macro_expand" fallthroughContext="shell_in_brace_parameters">
0690         <DetectChar attribute="Macro call" context="#pop" char="}"/>
0691         <WordDetect attribute="Shell keyword" String="function" context="shell_in_brace_function"/>
0692         <keyword attribute="Shell keyword" String="bash_keyword" additionalDeliminator="&amp;|});"/>
0693         <DetectIdentifier attribute="Shell commands" context="shell_in_brace_parameters"/>
0694         <DetectSpaces attribute="Shell commands"/>
0695         <AnyChar attribute="Shell symbol" String="&amp;|;!"/>
0696         <DetectChar char="`" context="shell_in_brace_bq" attribute="Shell symbol"/>
0697         <Detect2Chars attribute="Shell variable" char="(" char1="(" context="shell_in_brace_expr"/>
0698         <DetectChar attribute="Shell symbol" char="(" context="shell_in_brace_subcommand"/>
0699         <DetectChar attribute="Comment" char="#" context="shell_in_brace_comment"/>
0700         <StringDetect attribute="Shell commands" String="[[ " context="shell_in_brace_cond2"/>
0701         <DetectChar attribute="Shell keyword" char="{" context="shell_in_brace_brace"/>
0702         <IncludeRules context="shell_find_redirections"/>
0703         <RegExpr attribute="Shell commands" context="shell_in_brace_parameters" String="[^ \t&lt;>|&amp;;()${}'&quot;`\\%#]++"/>
0704       </context>
0705 
0706       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_brace_find_blank_and_ident" fallthroughContext="#pop">
0707         <RegExpr attribute="Comment" String="^#|\s+#" context="shell_in_brace_comment"/>
0708         <RegExpr attribute="Shell keyword" String="(^|\s+)\{&lookahead_whitespace_eol;" context="shell_in_brace_brace"/>
0709         <IncludeRules context="find_spaces_and_ident"/>
0710       </context>
0711 
0712       <!-- %{expand with function -->
0713       <context attribute="Shell commands" lineEndContext="#stay" name="shell_in_brace_function" fallthroughContext="#pop">
0714         <DetectChar attribute="Shell keyword" context="#pop!shell_in_brace_brace" char="{"/>
0715         <DetectChar context="#pop" char="}" lookAhead="1"/>
0716         <Detect2Chars char="(" char1=")"/>
0717         <IncludeRules context="find_spaces_and_ident"/>
0718       </context>
0719 
0720       <!-- %{expand with { -->
0721       <context attribute="Shell commands" lineEndContext="#stay" name="shell_in_brace_brace">
0722         <DetectChar attribute="Shell keyword" context="#pop" char="}"/>
0723         <IncludeRules context="macro_expand"/>
0724       </context>
0725 
0726       <!-- %{expand with # -->
0727       <context attribute="Comment" lineEndContext="#pop" name="shell_in_brace_comment">
0728         <DetectChar attribute="Comment" char="{" context="shell_in_brace_comment_brace"/>
0729         <DetectChar char="}" context="#pop" lookAhead="1"/>
0730         <IncludeRules context="shell_in_section_comment"/>
0731       </context>
0732       <context attribute="Comment" lineEndContext="#pop" name="shell_in_brace_comment_brace">
0733         <DetectChar attribute="Comment" char="}" context="#pop"/>
0734         <IncludeRules context="shell_in_brace_comment"/>
0735       </context>
0736 
0737       <!-- %{expand with ` -->
0738       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_brace_bq" fallthroughContext="shell_in_brace_parameters">
0739         <DetectChar char="`" context="#pop" attribute="Shell symbol"/>
0740         <DetectChar char="}" context="#pop" lookAhead="1"/>
0741         <IncludeRules context="macro_expand"/>
0742       </context>
0743 
0744       <!-- %{expand with cmd ... -->
0745       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_brace_parameters">
0746         <IncludeRules context="shell_in_brace_find_blank_and_ident"/>
0747         <AnyChar context="#pop" String="})`" lookAhead="1"/>
0748         <AnyChar attribute="Shell symbol" String="&amp;|;" context="#pop"/>
0749         <AnyChar attribute="Shell symbol" String="*?"/>
0750         <DetectChar attribute="Shell commands" context="shell_in_brace_parameters_brace" char="{"/>
0751         <IncludeRules context="shell_in_brace_find_word"/>
0752         <IncludeRules context="shell_find_redirections"/>
0753       </context>
0754       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_brace_parameters_brace">
0755         <DetectChar attribute="Shell commands" context="#pop" char="}"/>
0756         <AnyChar String="&amp;|;" context="#pop" lookAhead="1"/>
0757         <IncludeRules context="shell_in_brace_parameters"/>
0758       </context>
0759 
0760       <!-- %{expand with [[ -->
0761       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_brace_cond2">
0762         <Detect2Chars attribute="Shell commands" char="]" char1="]" context="#pop"/>
0763         <AnyChar attribute="Shell symbol" String="&amp;|;"/>
0764         <DetectChar attribute="Shell symbol" char="(" context="shell_in_brace_sub_cond2"/>
0765         <IncludeRules context="shell_in_brace_parameters"/>
0766       </context>
0767       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_brace_sub_cond2">
0768         <DetectChar attribute="Shell symbol" char=")" context="#pop"/>
0769         <AnyChar attribute="Shell symbol" String="&amp;|;"/>
0770         <DetectChar attribute="Shell symbol" char="(" context="shell_in_brace_sub_cond2"/>
0771         <Detect2Chars char="]" char1="]" context="#pop" lookAhead="1"/>
0772         <IncludeRules context="shell_in_brace_parameters"/>
0773       </context>
0774 
0775       <context attribute="Shell commands" lineEndContext="#pop" name="shell_find_redirections">
0776         <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;;|`]+)?"/>
0777       </context>
0778 
0779       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_brace_find_word" fallthroughContext="#pop">
0780         <IncludeRules context="shell_in_brace_find_variable"/>
0781         <DetectChar attribute="Shell string" char="'" context="shell_in_brace_sq_string"/>
0782         <DetectChar attribute="Shell string" char="&quot;" context="shell_in_brace_dq_string"/>
0783         <IncludeRules context="shell_find_escape"/>
0784         <DetectChar char="`" context="#pop" lookAhead="1"/>
0785       </context>
0786 
0787       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_brace_find_variable">
0788         <!-- Handle % -->
0789         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0790         <Detect2Chars attribute="Shell string" char="$" char1="'" context="shell_in_brace_variable_sq"/>
0791         <StringDetect attribute="Shell variable" String="$((" context="shell_in_brace_expr"/>
0792         <Detect2Chars attribute="Shell symbol" char="$" char1="(" context="shell_in_brace_subcommand"/>
0793         <Detect2Chars attribute="Shell variable" char="$" char1="{" context="shell_in_brace_variable_brace"/>
0794         <DetectChar attribute="Shell variable" char="$" context="shell_single_variable"/>
0795       </context>
0796 
0797       <context attribute="Shell commands" lineEndContext="#pop" name="shell_find_escape">
0798         <DetectChar attribute="Shell symbol" char="\" context="shell_in_brace_escape" lookAhead="1"/>
0799       </context>
0800       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_brace_escape">
0801         <RegExpr attribute="Escaped character" context="#pop" String="\\."/>
0802         <LineContinue attribute="Line break" context="#pop"/>
0803       </context>
0804 
0805       <!-- %{expand with $' -->
0806       <context attribute="Shell string" lineEndContext="#pop" name="shell_in_brace_variable_sq">
0807         <IncludeRules context="find_spaces_and_ident"/>
0808         <DetectChar char="'" context="#pop" attribute="Shell string"/>
0809         <DetectChar char="}" context="#pop" lookAhead="1"/>
0810         <DetectChar char="{" context="shell_in_brace_variable_sq_brace" attribute="Shell string"/>
0811         <IncludeRules context="shell_find_escape"/>
0812         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0813       </context>
0814       <context attribute="Shell string" lineEndContext="#pop" name="shell_in_brace_variable_sq_brace">
0815         <DetectChar char="'" context="#pop" lookAhead="1"/>
0816         <DetectChar char="}" context="#pop" attribute="Shell string"/>
0817         <IncludeRules context="shell_in_brace_variable_sq"/>
0818       </context>
0819 
0820       <!-- %{expand with $(( -->
0821       <context attribute="Shell variable" lineEndContext="#pop" name="shell_in_brace_expr">
0822         <IncludeRules context="shell_in_brace_find_blank_and_ident"/>
0823         <DetectChar char="}" context="#pop" lookAhead="1"/>
0824         <Detect2Chars char=")" char1=")" context="#pop" attribute="Shell variable"/>
0825         <DetectChar char=")" context="#pop!shell_in_brace_subcommand" attribute="Shell variable"/>
0826         <DetectChar char="(" context="shell_in_brace_subexpr" attribute="Shell symbol"/>
0827         <IncludeRules context="shell_in_brace_find_word"/>
0828       </context>
0829       <context attribute="Shell variable" lineEndContext="#pop" name="shell_in_brace_subexpr">
0830         <IncludeRules context="shell_in_brace_find_blank_and_ident"/>
0831         <DetectChar char="}" context="#pop" lookAhead="1"/>
0832         <DetectChar char=")" context="#pop" attribute="Shell symbol"/>
0833         <DetectChar char="(" context="shell_in_brace_subexpr" attribute="Shell symbol"/>
0834         <IncludeRules context="shell_in_brace_find_word"/>
0835       </context>
0836 
0837       <!-- %{expand with $( -->
0838       <context attribute="Shell string" lineEndContext="#pop" name="shell_in_brace_subcommand">
0839         <DetectChar char="}" context="#pop" lookAhead="1"/>
0840         <DetectChar char=")" context="#pop" attribute="Shell symbol"/>
0841         <IncludeRules context="macro_expand"/>
0842       </context>
0843 
0844       <!-- %{expand with ${ -->
0845       <context attribute="Shell variable" lineEndContext="#pop" name="shell_in_brace_variable_brace">
0846         <DetectChar attribute="Shell variable" char="}" context="#pop"/>
0847         <DetectChar attribute="Shell variable" char="{" context="shell_in_brace_variable_brace"/>
0848         <DetectIdentifier attribute="Shell variable"/>
0849         <IncludeRules context="shell_in_brace_find_word"/>
0850       </context>
0851 
0852       <!-- %{expand with $ -->
0853       <context attribute="Shell variable" lineEndContext="#pop" name="shell_single_variable" fallthroughContext="#pop">
0854         <DetectIdentifier attribute="Shell variable" context="#pop"/>
0855         <AnyChar attribute="Shell variable" context="#pop" String="*@#?$!0123456789-"/>
0856       </context>
0857 
0858       <!-- %{expand with ' -->
0859       <context attribute="Shell string" lineEndContext="#pop" name="shell_in_brace_sq_string">
0860         <IncludeRules context="find_spaces_and_ident"/>
0861         <DetectChar char="}" context="#pop" lookAhead="1"/>
0862         <DetectChar char="'" context="#pop" attribute="Shell string"/>
0863         <DetectChar char="{" context="shell_in_brace_sq_string_brace" attribute="Shell string"/>
0864         <Detect2Chars char="\" char1="}" attribute="Escaped character"/>
0865         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0866       </context>
0867       <context attribute="Shell string" lineEndContext="#pop" name="shell_in_brace_sq_string_brace">
0868         <DetectChar char="}" context="#pop" attribute="Shell string"/>
0869         <DetectChar char="'" context="#pop" lookAhead="1"/>
0870         <IncludeRules context="shell_in_brace_sq_string"/>
0871       </context>
0872 
0873       <!-- %{expand with " -->
0874       <context attribute="Shell string" lineEndContext="#pop" name="shell_in_brace_dq_string">
0875         <IncludeRules context="find_spaces_and_ident"/>
0876         <DetectChar char="&quot;" context="#pop" attribute="Shell string"/>
0877         <DetectChar char="}" context="#pop" lookAhead="1"/>
0878         <DetectChar char="{" context="shell_in_brace_dq_string_brace" attribute="Shell string"/>
0879         <IncludeRules context="shell_find_escape"/>
0880         <IncludeRules context="shell_in_brace_find_variable"/>
0881         <DetectChar char="`" context="shell_in_brace_bq" attribute="Shell symbol"/>
0882       </context>
0883       <context attribute="Shell string" lineEndContext="#pop" name="shell_in_brace_dq_string_brace">
0884         <DetectChar char="&quot;" context="#pop" lookAhead="1"/>
0885         <DetectChar char="}" context="#pop" attribute="Shell string"/>
0886         <IncludeRules context="shell_in_brace_dq_string"/>
0887       </context>
0888 
0889 
0890       <!-- Used internally by "command section" -->
0891       <context attribute="Shell commands" lineEndContext="#stay" name="shell in section" fallthroughContext="shell_in_section_parameters">
0892         <keyword attribute="Shell keyword" String="bash_keyword" additionalDeliminator="&amp;|;"/>
0893         <DetectIdentifier attribute="Shell commands" context="shell_in_section_parameters"/>
0894         <DetectSpaces attribute="Shell commands"/>
0895         <AnyChar attribute="Shell symbol" String="&amp;|;!"/>
0896         <DetectChar char="`" context="shell_in_section_bq" attribute="Shell symbol"/>
0897         <Detect2Chars attribute="Shell variable" char="(" char1="(" context="shell_in_parenthesis_expr"/>
0898         <DetectChar attribute="Shell symbol" char="(" context="shell_in_parenthesis_subcommand"/>
0899         <DetectChar attribute="Comment" char="#" context="shell_in_section_comment"/>
0900         <StringDetect attribute="Shell commands" String="[[ " context="shell_in_section_cond2"/>
0901         <DetectChar attribute="Shell keyword" char="{" context="shell_in_section_brace"/>
0902         <IncludeRules context="shell_find_redirections"/>
0903         <RegExpr attribute="Shell commands" context="shell_in_section_parameters" String="[^ \t&lt;>|&amp;;()${}'&quot;`\\%#]++"/>
0904         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0905       </context>
0906 
0907       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_section_blank_and_ident" fallthroughContext="#pop">
0908         <RegExpr attribute="Comment" String="^#|\s+#" context="shell_in_section_comment"/>
0909         <RegExpr attribute="Shell keyword" String="(^|\s+)\{&lookahead_whitespace_eol;" context="shell_in_section_brace"/>
0910         <IncludeRules context="find_spaces_and_ident"/>
0911       </context>
0912 
0913       <!-- sections with { -->
0914       <context attribute="Shell commands" lineEndContext="#stay" name="shell_in_section_brace">
0915         <DetectChar attribute="Shell keyword" context="#pop" char="}"/>
0916         <IncludeRules context="shell in section"/>
0917       </context>
0918 
0919       <!-- section with # -->
0920       <context attribute="Comment" lineEndContext="#pop" name="shell_in_section_comment">
0921         <!-- Warning on single percent ("%"), but not on double percent ("%%"): -->
0922         <Detect2Chars attribute="Comment" char="%" char1="%"/>
0923         <DetectChar attribute="Warning" char="%"/>
0924         <DetectSpaces />
0925         <IncludeRules context="##Comments"/> <!-- Alert -->
0926         <DetectIdentifier />
0927       </context>
0928 
0929       <!-- section with ` -->
0930       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_section_bq" fallthroughContext="shell_in_section_parameters">
0931         <DetectChar char="`" context="#pop" attribute="Shell symbol"/>
0932         <IncludeRules context="shell in section"/>
0933       </context>
0934 
0935       <!-- section with cmd ... -->
0936       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_section_parameters">
0937         <IncludeRules context="shell_in_section_blank_and_ident"/>
0938         <AnyChar attribute="Shell symbol" String="&amp;|;" context="#pop"/>
0939         <AnyChar attribute="Shell symbol" String="*?"/>
0940         <IncludeRules context="shell_in_section_find_variable"/>
0941         <DetectChar attribute="Shell string" char="'" context="shell_in_section_sq_string"/>
0942         <DetectChar attribute="Shell string" char="&quot;" context="shell_in_section_dq_string"/>
0943         <IncludeRules context="shell_find_escape"/>
0944         <DetectChar char="`" context="#pop" lookAhead="1"/>
0945         <IncludeRules context="shell_find_redirections"/>
0946       </context>
0947 
0948       <!-- section with [[ -->
0949       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_section_cond2">
0950         <Detect2Chars attribute="Shell commands" char="]" char1="]" context="#pop"/>
0951         <AnyChar attribute="Shell symbol" String="&amp;|;"/>
0952         <IncludeRules context="shell_in_section_parameters"/>
0953       </context>
0954 
0955       <context attribute="Shell commands" lineEndContext="#pop" name="shell_in_section_find_variable">
0956         <!-- Handle % -->
0957         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0958         <Detect2Chars attribute="Shell string" char="$" char1="'" context="shell_in_section_variable_sq"/>
0959         <StringDetect attribute="Shell variable" String="$((" context="shell_in_parenthesis_expr"/>
0960         <Detect2Chars attribute="Shell symbol" char="$" char1="(" context="shell_in_parenthesis_subcommand"/>
0961         <Detect2Chars attribute="Shell variable" char="$" char1="{" context="shell_in_brace_variable_brace"/>
0962         <DetectChar attribute="Shell variable" char="$" context="shell_single_variable"/>
0963       </context>
0964 
0965       <!-- section with $' -->
0966       <context attribute="Shell string" lineEndContext="#pop" name="shell_in_section_variable_sq">
0967         <IncludeRules context="find_spaces_and_ident"/>
0968         <DetectChar char="'" context="#pop" attribute="Shell string"/>
0969         <IncludeRules context="shell_find_escape"/>
0970         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0971       </context>
0972 
0973       <!-- section with ' -->
0974       <context attribute="Shell string" lineEndContext="#pop" name="shell_in_section_sq_string">
0975         <IncludeRules context="find_spaces_and_ident"/>
0976         <DetectChar char="'" context="#pop" attribute="Shell string"/>
0977         <DetectChar context="handle_percent" char="%" lookAhead="1"/>
0978       </context>
0979 
0980       <!-- section with " -->
0981       <context attribute="Shell string" lineEndContext="#pop" name="shell_in_section_dq_string">
0982         <IncludeRules context="find_spaces_and_ident"/>
0983         <DetectChar char="&quot;" context="#pop" attribute="Shell string"/>
0984         <IncludeRules context="shell_find_escape"/>
0985         <IncludeRules context="shell_in_section_find_variable"/>
0986         <DetectChar char="`" context="shell_in_section_bq" attribute="Shell symbol"/>
0987       </context>
0988 
0989     </contexts>
0990 
0991     <itemDatas>
0992       <!-- "Shell commands" is used for the sections like %prep, %build or %install, where you write
0993       shell commands. -->
0994       <itemData name="Shell commands" defStyleNum="dsNormal"/>
0995       <itemData name="Shell keyword" defStyleNum="dsKeyword"/>
0996       <itemData name="Shell string" defStyleNum="dsString"/>
0997       <itemData name="Shell variable" defStyleNum="dsVariable"/>
0998       <itemData name="Shell symbol" defStyleNum="dsOperator"/>
0999       <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; -->