Problem with syntax highlighting regarding quotes in Perl

Started by swbrains, June 13, 2011, 10:23:46 PM

Previous topic - Next topic

swbrains

I have a Perl script that contains the line:

$title =~ s/\"/"/ig;

But the problem is that everything after the double quote (") is color highlighted as a string literal rather than actual code, etc.  It thinks it has an opening quote but no closing quote.  In this case, the escaped double quote \" should NOT be considered the start of a string literal for color highlighting.

Another case that causes it with a single quote (apostrophe) is as follows:

print <<"EOT";
This apostrophe ' causes the syntax highlighter to think everything after it
is a literal string including the $x = 0 code below...
EOT

$x = 0;

Any way to avoid this?

Thanks!

alex

Quote$title =~ s/\"/&quot;/ig;
the reason for such behavior is schema definition, that disables escaping for normal style:
<Style id="normal" extend="true" escaping="false"/>
I think, there was a reason for such decision. The only way I see to solve this, is to convert such structure  s/.../ig (probably) to a new style. And it would be escaped by default.
Can you tell if this can be done? Maybe s/.../ or several endings (works also fine)?
For example how it done here:
      <Style id="regexp" name="Regular Expression" text="1" bold="0" italic="0" underline="0" clr="Operator" bkclr="#FFFFFFFF">
        <Blocks>
          <Block open="qr/" close="/"/>
        </Blocks>
      </Style>


print <<"EOT";
This apostrophe ' causes the syntax highlighter to think everything after it
is a literal string including the $x = 0 code below...
EOT

$x = 0;

For such construction, I currently do not see any way, except of removing ' form style definition, because I do not see how it would be possible to define a syntax block based on provided example. And HE does not support regular expressions in syntax definitions (for styling).
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]