<lexer>
  <config>
    <name>Rego</name>
    <alias>rego</alias>
    <filename>*.rego</filename>
  </config>
  <rules>
    <state name="root">
      <rule pattern="(package|import|as|not|with|default|else|some|in|if|contains)\b">
        <token type="KeywordDeclaration"/>
      </rule>
      <!-- importing keywords should then show up as keywords -->
      <rule pattern="(import)( future.keywords.)(\w+)">
        <bygroups>
          <token type="KeywordDeclaration"/>
          <token type="Text"/>
          <token type="KeywordDeclaration"/>
        </bygroups>
      </rule>
      <rule pattern="#[^\r\n]*">
        <token type="Comment"/>
      </rule>
      <rule pattern="(FIXME|TODO|XXX)\b( .*)$">
        <bygroups>
          <token type="Error"/>
          <token type="CommentSpecial"/>
        </bygroups>
      </rule>
      <rule pattern="(true|false|null)\b">
        <token type="KeywordConstant"/>
      </rule>
      <rule pattern="\d+i">
        <token type="LiteralNumber"/>
      </rule>
      <rule pattern="\d+\.\d*([Ee][-+]\d+)?i">
        <token type="LiteralNumber"/>
      </rule>
      <rule pattern="\.\d+([Ee][-+]\d+)?i">
        <token type="LiteralNumber"/>
      </rule>
      <rule pattern="\d+[Ee][-+]\d+i">
        <token type="LiteralNumber"/>
      </rule>
      <rule pattern="\d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)">
        <token type="LiteralNumberFloat"/>
      </rule>
      <rule pattern="\.\d+([eE][+\-]?\d+)?">
        <token type="LiteralNumberFloat"/>
      </rule>
      <rule pattern="(0|[1-9][0-9]*)">
        <token type="LiteralNumberInteger"/>
      </rule>
      <rule pattern="&#34;&#34;&#34;.*?&#34;&#34;&#34;">
        <token type="LiteralStringDouble"/>
      </rule>
      <rule pattern="&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
        <token type="LiteralStringDouble"/>
      </rule>
      <rule pattern="\$/((?!/\$).)*/\$">
        <token type="LiteralString"/>
      </rule>
      <rule pattern="/(\\\\|\\&#34;|[^/])*/">
        <token type="LiteralString"/>
      </rule>
      <rule pattern="^(\w+)">
        <token type="Name"/>
      </rule>
      <rule pattern="[a-z_-][\w-]*(?=\()">
        <token type="NameFunction"/>
      </rule>
      <rule pattern="[\r\n\s]+">
        <token type="TextWhitespace"/>
      </rule>
      <rule pattern="(package|import)(\s+)">
        <bygroups>
          <token type="KeywordDeclaration"/>
          <token type="Text"/>
        </bygroups>
      </rule>
      <rule pattern="[=&lt;&gt;!+-/*&amp;|]">
        <token type="Operator"/>
      </rule>
      <rule pattern=":=">
        <token type="Operator"/>
      </rule>
      <rule pattern="[[\]{}():;]+">
        <token type="Punctuation"/>
      </rule>
      <rule pattern="[$a-zA-Z_]\w*">
        <token type="NameOther"/>
      </rule>
    </state>
  </rules>
</lexer>