Page 1 of 1

Perl syntax: recognize double-quotes in quote-like blocks

Posted: Sat Sep 20, 2003 12:43 am
by AntiEntropy
Okay, that subject line is not easy to understand. Here's the problem:

Code: Select all

#!/usr/bin/perl -w

$_= qq/"text with actual quotes"/;

# Strip quotes
s/^"//;
s/"$//;
See those double quotes in lines six and seven? The syntax highlighter thinks everything from the middle of line six to the middle of line seven is quoted, but it's not or course. It's much worse when you have a line with one quote and no other line like that for a long time. You either have to turn off multi-line quoting of do something like this:

Code: Select all

s/^"//; #"
s/"$//; #"

Posted: Sat Sep 20, 2003 10:52 am
by MudGuard
How should Textpad determine whether a " starts a string or is a single character?
No, the s/ can't be used to determine that as the / in s/ can be replaced by any other charater, e.g.
s#^"##;

This would need a full perl parser...

I don't think this will be implemented in Textpad, perl syntax is extremely complex...

Posted: Sat Sep 20, 2003 12:59 pm
by webmasta

Posted: Sun Sep 21, 2003 7:55 am
by csalsa

Posted: Mon Sep 22, 2003 5:07 pm
by AntiEntropy
I did, but not because I didn't look.

I guess I misinterpretted this:
Perl syntax highlighting is now handled by its own lexical scanner, to make it more robust in detecting when # starts a comment. This requires use of the new perl5.syn syntax definition file.
I guess what that fixes is:

Code: Select all

$last_elem = $array[$#];
...which is great, BTW.

Posted: Mon Sep 22, 2003 5:08 pm
by AntiEntropy
csalsa wrote:Consider also voting in the poll:

Add support for Perl5/JavaScript regular expressions
I did, thanks.