<lexer>
  <config>
    <name>Go Template</name>
    <alias>go-template</alias>
    <filename>*.gotmpl</filename>
    <filename>*.go.tmpl</filename>
  </config>
  <rules>
    <state name="template">
      <rule pattern="[-]?}}">
        <token type="CommentPreproc"/>
        <pop depth="1"/>
      </rule>
      <rule pattern="(?=}})">
        <token type="CommentPreproc"/>
        <pop depth="1"/>
      </rule>
      <rule pattern="\(">
        <token type="Operator"/>
        <push state="subexpression"/>
      </rule>
      <rule pattern="&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
        <token type="LiteralString"/>
      </rule>
      <rule>
        <include state="expression"/>
      </rule>
    </state>
    <state name="subexpression">
      <rule pattern="\)">
        <token type="Operator"/>
        <pop depth="1"/>
      </rule>
      <rule>
        <include state="expression"/>
      </rule>
    </state>
    <state name="expression">
      <rule pattern="\s+">
        <token type="TextWhitespace"/>
      </rule>
      <rule pattern="\(">
        <token type="Operator"/>
        <push state="subexpression"/>
      </rule>
      <rule pattern="(range|if|else|while|with|template|end|true|false|nil|and|call|html|index|js|len|not|or|print|printf|println|urlquery|eq|ne|lt|le|gt|ge|block|break|continue|define|slice)\b">
        <token type="Keyword"/>
      </rule>
      <rule pattern="\||:?=|,">
        <token type="Operator"/>
      </rule>
      <rule pattern="[$]?[^\W\d]\w*">
        <token type="NameOther"/>
      </rule>
      <rule pattern="\$|[$]?\.(?:[^\W\d]\w*)?">
        <token type="NameAttribute"/>
      </rule>
      <rule pattern="&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
        <token type="LiteralString"/>
      </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[0-7]+">
        <token type="LiteralNumberOct"/>
      </rule>
      <rule pattern="-?0[xX][0-9a-fA-F]+">
        <token type="LiteralNumberHex"/>
      </rule>
      <rule pattern="-?0b[01_]+">
        <token type="LiteralNumberBin"/>
      </rule>
      <rule pattern="-?(0|[1-9][0-9]*)">
        <token type="LiteralNumberInteger"/>
      </rule>
      <rule pattern="&#39;(\\[&#39;&#34;\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])&#39;">
        <token type="LiteralStringChar"/>
      </rule>
      <rule pattern="`[^`]*`">
        <token type="LiteralString"/>
      </rule>
    </state>
    <state name="root">
      <rule pattern="{{(- )?/\*(.|\n)*?\*/( -)?}}">
        <token type="CommentMultiline"/>
      </rule>
      <rule pattern="{{[-]?">
        <token type="CommentPreproc"/>
        <push state="template"/>
      </rule>
      <rule pattern="[^{]+">
        <token type="Other"/>
      </rule>
      <rule pattern="{">
        <token type="Other"/>
      </rule>
    </state>
  </rules>
</lexer>