        <bygroups>
          <token type="CommentPreproc"/>
          <using lexer="Python"/>
        </bygroups>
      </rule>
      <rule pattern="(\$\{!?)(.*?)(\})(?s)">
        <bygroups>
          <token type="CommentPreproc"/>
          <using lexer="Python"/>
          <token type="CommentPreproc"/>
        </bygroups>
      </rule>
      <rule pattern="(?sx)&#xA;                (.+?)               # anything, followed by:&#xA;                (?:&#xA;                 (?=\#[#a-zA-Z]*) | # an eval comment&#xA;                 (?=\$[a-zA-Z_{]) | # a substitution&#xA;                 \Z                 # end of string&#xA;                )&#xA;            ">
        <token type="Other"/>
      </rule>
      <rule pattern="\s+">
        <token type="Text"/>
      </rule>
    </state>
  </rules>
</lexer>