<lexer>
  <config>
    <name>lox</name>
    <filename>*.lox</filename>
    <dot_all>true</dot_all>
    <ensure_nl>true</ensure_nl>
  </config>
  <rules>
    <state name="whitespace">
      <rule pattern="\n">
        <token type="Text"/>
      </rule>
      <rule pattern="\s+">
        <token type="Text"/>
      </rule>
    </state>
    <state name="root">
      <rule>
        <include state="whitespace"/>
      </rule>
      <rule pattern="//.*?\n">
        <token type="CommentSingle"/>
      </rule>
      <rule pattern="(and|break|case|continue|default|else|for|if|or|print|return|super|switch|this|while)\b">
        <token type="Keyword"/>
      </rule>
      <rule pattern="(false|nil|true)\b">
        <token type="KeywordConstant"/>
      </rule>
      <rule pattern="(class)(\s+)([a-zA-Z_]\w*)">
        <bygroups>
          <token type="KeywordDeclaration"/>
          <token type="Text"/>
          <token type="NameClass"/>
        </bygroups>
      </rule>
      <rule pattern="(fun)(\s+)([a-zA-Z_]\w*)">
        <bygroups>
          <token type="KeywordDeclaration"/>
          <token type="Text"/>
          <token type="NameFunction"/>
        </bygroups>
      </rule>
      <rule pattern="(const)(\s+)([a-zA-Z_]\w*)">
        <bygroups>
          <token type="KeywordDeclaration"/>
          <token type="Text"/>
          <token type="NameConstant"/>
        </bygroups>
      </rule>
      <rule pattern="(var)(\s+)([a-zA-Z_]\w*)">
        <bygroups>
          <token type="KeywordDeclaration"/>
          <token type="Text"/>
          <token type="NameVariable"/>
        </bygroups>
      </rule>
      <rule pattern="\d+(\.\d*|[eE][+\-]?\d+)">
        <token type="LiteralNumberFloat"/>
      </rule>
      <rule pattern="[0-9][0-9]*">
        <token type="LiteralNumberInteger"/>
      </rule>
      <rule pattern="&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
        <token type="LiteralStringDouble"/>
      </rule>
      <rule pattern="!|\+|-|\*|/|&lt;|&gt;|=">
        <token type="Operator"/>
      </rule>
      <rule pattern="[{}():;.,]">
        <token type="Punctuation"/>
      </rule>
      <rule pattern="[a-zA-Z_]\w*">
        <token type="NameVariable"/>
      </rule>
    </state>
  </rules>
</lexer>
