rule pattern="\$(shortrealtobits|bitstoshortreal|printtimescale|showvariables|countdrivers|reset_value|reset_count|getpattern|showscopes|realtobits|bitstoreal|monitoroff|timeformat|sreadmemh|monitoron|sreadmemb|fmonitor|showvars|fdisplay|realtime|readmemb|readmemh|monitor|history|fstrobe|display|restart|incsave|strobe|fwrite|finish|random|fclose|stime|nokey|fopen|floor|nolog|scale|scope|input|reset|write|rtoi|bits|list|stop|itor|time|save|key|log)\b">
        <token type="NameBuiltin"/>
      </rule>
      <rule pattern="(woshortreal|shortint|realtime|longint|integer|supply0|supply1|triand|trireg|uwire|logic|trior|byte|wand|tri0|tri1|time|real|wire|reg|bit|int|tri)\b">
        <token type="KeywordType"/>
      </rule>
      <rule pattern="[a-zA-Z_]\w*:(?!:)">
        <token type="NameLabel"/>
      </rule>
      <rule pattern="\$?[a-zA-Z_]\w*">
        <token type="Name"/>
      </rule>
    </state>
    <state name="string">
      <rule pattern="&#34;">
        <token type="LiteralString"/>
        <pop depth="1"/>
      </rule>
      <rule pattern="\\([\\abfnrtv&#34;\&#39;]|x[a-fA-F0-9]{2,4}|[0-7]{1,3})">
        <token type="LiteralStringEscape"/>
      </rule>
      <rule pattern="[^\\&#34;\n]+">
        <token type="LiteralString"/>
      </rule>
      <rule pattern="\\\n">
        <token type="LiteralString"/>
      </rule>
      <rule pattern="\\">
        <token type="LiteralString"/>
      </rule>
    </state>
    <state name="macro">
      <rule pattern="[^/\n]+">
        <token type="CommentPreproc"/>
      </rule>
      <rule pattern="/[*](.|\n)*?[*]/">
        <token type="CommentMultiline"/>
      </rule>
      <rule pattern="//.*?\n">
        <token type="CommentSingle"/>
        <pop depth="1"/>
      </rule>
      <rule pattern="/">
        <token type="CommentPreproc"/>
      </rule>
      <rule pattern="(?&lt;=\\)\n">
        <token type="CommentPreproc"/>
      </rule>
      <rule pattern="\n">
        <token type="CommentPreproc"/>
        <pop depth="1"/>
      </rule>
    </state>
    <state name="import">
      <rule pattern="[\w:]+\*?">
        <token type="NameNamespace"/>
        <pop depth="1"/>
      </rule>
    </state>
  </rules>
</lexer>