 <token type="NameTag"/>
        </bygroups>
      </rule>
      <rule pattern="(?&lt;=^)#[^\n]*(\n|\Z)">
        <token type="Comment"/>
      </rule>
      <rule pattern="(?&lt;=^)(%)([^\n]*)(\n|\Z)">
        <bygroups>
          <token type="NameTag"/>
          <using lexer="Python2"/>
          <token type="Other"/>
        </bygroups>
      </rule>
      <rule pattern="(?sx)&#xA;                 (.+?)               # anything, followed by:&#xA;                 (?:&#xA;                  (?&lt;=\n)(?=[%#]) |  # an eval or comment line&#xA;                  (?=&lt;/?[%&amp;]) |      # a substitution or block or&#xA;                                     # call start or end&#xA;                                     # - don&#39;t consume&#xA;                  (\\\n) |           # an escaped newline&#xA;                  \Z                 # end of string&#xA;                 )">
        <bygroups>
          <token type="Other"/>
          <token type="Operator"/>
        </bygroups>
      </rule>
    </state>
  </rules>
</lexer>