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

Ideas for new features

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply

Should TextPad recognize double-quotes in Perl quote-like blocks?

Absolutely
5
50%
Yeah, maybe
3
30%
Don't care
1
10%
Not really
0
No votes
No way
1
10%
 
Total votes: 10

User avatar
AntiEntropy
Posts: 11
Joined: Sat Sep 20, 2003 12:28 am

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

Post 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/"$//; #"
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post 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...
User avatar
webmasta
Posts: 168
Joined: Mon Jul 28, 2003 8:16 pm
Location: Toronto

Post by webmasta »

csalsa
Posts: 20
Joined: Mon Jul 14, 2003 1:36 am

Post by csalsa »

User avatar
AntiEntropy
Posts: 11
Joined: Sat Sep 20, 2003 12:28 am

Post 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.
User avatar
AntiEntropy
Posts: 11
Joined: Sat Sep 20, 2003 12:28 am

Post by AntiEntropy »

csalsa wrote:Consider also voting in the poll:

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