
<lexer>
  <config>
    <name>RPMSpec</name>
    <alias>spec</alias>
    <filename>*.spec</filename>
    <mime_type>text/x-rpm-spec</mime_type>
  </config>
  <rules>
    <state name="root">
      <rule pattern="#.*$"><token type="Comment"/></rule>
      <rule><include state="basic"/></rule>
    </state>
    <state name="description">
      <rule pattern="^(%(?:package|prep|build|install|clean|check|pre[a-z]*|post[a-z]*|trigger[a-z]*|files))(.*)$"><bygroups><token type="NameDecorator"/><token type="Text"/></bygroups><pop depth="1"/></rule>
      <rule pattern="\s+"><token type="TextWhitespace"/></rule>
      <rule pattern="."><token type="Text"/></rule>
    </state>
    <state name="changelog">
      <rule pattern="\*.*$"><token type="GenericSubheading"/></rule>
      <rule pattern="^(%(?:package|prep|build|install|clean|check|pre[a-z]*|post[a-z]*|trigger[a-z]*|files))(.*)$"><bygroups><token type="NameDecorator"/><token type="Text"/></bygroups><pop depth="1"/></rule>
      <rule pattern="\s+"><token type="TextWhitespace"/></rule>
      <rule pattern="."><token type="Text"/></rule>
    </state>
    <state name="string">
      <rule pattern="&quot;"><token type="LiteralStringDouble"/><pop depth="1"/></rule>
      <rule pattern="\\([\\abfnrtv&quot;\&#x27;]|x[a-fA-F0-9]{2,4}|[0-7]{1,3})"><token type="LiteralStringEscape"/></rule>
      <rule><include state="interpol"/></rule>
      <rule pattern="."><token type="LiteralStringDouble"/></rule>
    </state>
    <state name="basic">
      <rule><include state="macro"/></rule>
      <rule pattern="(?i)^(Name|Version|Release|Epoch|Summary|Group|License|Packager|Vendor|Icon|URL|Distribution|Prefix|Patch[0-9]*|Source[0-9]*|Requires\(?[a-z]*\)?|[a-z]+Req|Obsoletes|Suggests|Provides|Conflicts|Build[a-z]+|[a-z]+Arch|Auto[a-z]+)(:)(.*)$"><bygroups><token type="GenericHeading"/><token type="Punctuation"/><usingself state="root"/></bygroups></rule>
      <rule pattern="^%description"><token type="NameDecorator"/><push state="description"/></rule>
      <rule pattern="^%changelog"><token type="NameDecorator"/><push state="changelog"/></rule>
      <rule pattern="^(%(?:package|prep|build|install|clean|check|pre[a-z]*|post[a-z]*|trigger[a-z]*|files))(.*)$"><bygroups><token type="NameDecorator"/><token type="Text"/></bygroups></rule>
      <rule pattern="%(attr|defattr|dir|doc(?:dir)?|setup|config(?:ure)?|make(?:install)|ghost|patch[0-9]+|find_lang|exclude|verify)"><token type="Keyword"/></rule>
      <rule><include state="interpol"/></rule>
      <rule pattern="&#x27;.*?&#x27;"><token type="LiteralStringSingle"/></rule>
      <rule pattern="&quot;"><token type="LiteralStringDouble"/><push state="string"/></rule>
      <rule pattern="\s+"><token type="TextWhitespace"/></rule>
      <rule pattern="."><token type="Text"/></rule>
    </state>
    <state name="macro">
      <rule pattern="%define.*$"><token type="CommentPreproc"/></rule>
      <rule pattern="%\{\!\?.*%define.*\}"><token type="CommentPreproc"/></rule>
      <rule pattern="(%(?:if(?:n?arch)?|else(?:if)?|endif))(.*)$"><bygroups><token type="CommentPreproc"/><token type="Text"/></bygroups></rule>
    </state>
    <state name="interpol">
      <rule pattern="%\{?__[a-z_]+\}?"><token type="NameFunction"/></rule>
      <rule pattern="%\{?_([a-z_]+dir|[a-z_]+path|prefix)\}?"><token type="KeywordPseudo"/></rule>
      <rule pattern="%\{\?\w+\}"><token type="NameVariable"/></rule>
      <rule pattern="\$\{?RPM_[A-Z0-9_]+\}?"><token type="NameVariableGlobal"/></rule>
      <rule pattern="%\{[a-zA-Z]\w+\}"><token type="KeywordConstant"/></rule>
    </state>
  </rules>
</lexer>

