Background:
In Perl, if a hash called %h has an element whose key is 'foo', you can address it
in two equivalent ways:
$h{'foo'}
$h{foo}
In the second case, 'foo' is said to be autoquoted.
The bug:
Create and save this file:
#\!/usr/bin/perl -l
my %hash = (height => 2, width => 3);
my $rh = \%hash;
print $hash{height};
print $$rh{height};
print $rh->{height};
my @a = map {quotemeta} keys %hash;
for (@a) {print};
In each of the three print statements, jEdit correctly spots that \`height' is autoquoted,
and highlights it as a literal string. However, in the last two lines, it also highlights
\`quotemeta' and \`print' as literal strings; this is a bug.
A heuristic that's probably good enough is to autoquote the contents of the braces
only if the open-brace is immediately preceded by a non-blank character. That would
fix the behaviour in this example.
We probably need a fix for bug 1946895 (look-behind not working) before we can fix
this autoquoting bug. If we had that, a possible fix would be to change this paragraph
of perl.xml --
<\!-- non-quoted literals in hashes -->
<SPAN_REGEXP TYPE="OPERATOR" HASH_CHAR="{" NO_LINE_BREAK="TRUE" DELEGATE="LITERAL">
<BEGIN>\\{(?=\s\*\[\p{Alpha}_\-\]\[\p{Alnum}_\]\*\s\*\\})</BEGIN>
<END>}</END>
</SPAN_REGEXP>
-- to look like this:
<\!-- non-quoted literals in hashes -->
<SPAN_REGEXP TYPE="OPERATOR" HASH_CHAR="{" NO_LINE_BREAK="TRUE" DELEGATE="LITERAL">
<BEGIN>(?<=\S)\\{(?=\s\*\[\p{Alpha}_\-\]\[\p{Alnum}_\]\*\s\*\\})</BEGIN>
<END>}</END>
</SPAN_REGEXP>
(The change consists of a few characters added immediately after <BEGIN> tag.)
Submitted | markuslaker - 2008-04-20 12:13:21 | Assigned | przemo_w |
---|---|---|---|
Priority | 5 | Labels | |
Status | open | Group | None |
Resolution | None |
2008-04-20 18:54:57 ezust |
- **labels**: 102669 --> |
---|---|
2008-04-20 18:54:57 ezust |
Logged In: YES |
2008-04-25 18:05:07 ezust |
- **assigned_to**: nobody --> vanza |
2008-05-01 05:00:39 vanza |
Logged In: YES |
2011-11-10 03:38:35 vanza |
- **assigned_to**: vanza --> nobody |
2011-12-06 02:05:51 ezust |
- **assigned_to**: nobody --> przemo_w |