SuperEdi

User: Guest

Search

Please use the
Bug Report Form
if you think you found a software defect.

Use the Contact Form
to send a personal message to Wolfgang.

RSS Feed RSS Feed

Other boards:
Juke
QBrowser
Raduga (English)
Song Requester

Highlighter doesn't work right with perl and dbl quote

Posted on: SuperEdi

From Message

CR

2012-03-14 16:08:13

Highlighter doesn't work right with perl and dbl quote

SuperEdit 4.3.1U on Win7.

If we take this piece of Perl code here:

if ($pr=~m/[\"]/)
{
$s="ERROR reading data: dbl quote found in price: $pr";
writeerr($s);
$errcnt++;
}
if ($part=~m/303268/)
{
$t=$&;
$s="Read part $t, $pr";
#writeerr($s);
}

The double quote in the IF statement causes the highlighter to highlight the code incorrectly. For example, the commented "#writeerr($s);" is now red.

Any fixes for this?

Wolfgang Loch

2012-03-14 20:55:27

Re: Highlighter doesn't work right with perl and dbl quote

The reason is the regex containing a double quote on line 1.

The syntax highlighting parser does not cope correctly with Perl regular expressions, because they are ver hard to recognize.

The regex can be written in many ways, for example:

if( $pr =~ m/[\"]/ )
if( $pr =~ /[\"]/ )
if( $pr =~ /
[\"] # quote characters
/x )
if( $pr =~ m,[\"], )
if( $pr =~ m{[\"]} )
$_ = $pr; if( /[\"]/ )
$_ = $pr; if( m|[\"]| )

Since the syntax highlighting parser itself uses regular expressions, we would need a regex that can recognize all these possibilities, but does not find false positives like in
if( $x / 2 > $y / 3 )

Any suggestions are welcome.

Workaround: add a comment after such regexes:
if ($pr=~m/[\"]/) #"

Post a reply to this message: