develooper Front page | perl.perl5.porters | Postings from January 2012

Re: \Questions about the \Future of \Escapes

Thread Previous | Thread Next
From:
demerphq
Date:
January 4, 2012 15:01
Subject:
Re: \Questions about the \Future of \Escapes
Message ID:
CANgJU+UKXhgLi2GEGQhHLdqhQp9GhBUhqCOmxYB-XEawkZMqPg@mail.gmail.com
On 4 January 2012 23:23, demerphq <demerphq@gmail.com> wrote:
> On 4 January 2012 23:14, demerphq <demerphq@gmail.com> wrote:
>> On 4 January 2012 22:40, Ricardo Signes <perl.p5p@rjbs.manxome.org> wrote:
>>>
>>> \F and fc should be landing any time now, as I understand things.
>>>
>>> Karl has expressed concern a few times, because of the problems here:
>>>
>>>  ~$ perl -E 'say "f" =~ qr"\L\x{66}"i ? 1 : 0'
>>>  1
>>>
>>>  ~$ perl -E 'say "f" =~ qr"\U\x{66}"i ? 1 : 0'
>>>  0
>>>
>>> The \U and \L affect the spelling of \x (making it \X in the latter example),
>>> which is, if not obviously wrong,
>>
>> I am not sure if this has been pointed out before, and I have not
>> actually checked, but I am reasonably confident that this is a
>> (untested presumably) regression that was introduced somewhere in late
>> 5.9 or so.
>
> Gah. Its not. I should have checked first, but the similarity with
> previous bugs related to this patch is pretty interesting. Although I
> stand by my recommendation for solving the problem.

I checked, and doing:

diff --git a/toke.c b/toke.c
index 8fb6164..488759a 100644
--- a/toke.c
+++ b/toke.c
@@ -2925,7 +2925,7 @@ S_scan_const(pTHX_ char *start)
            }

            /* string-change backslash escapes */
-           if (PL_lex_inwhat != OP_TRANS && *s && strchr("lLuUEQ", *s)) {
+           if (PL_lex_inwhat != OP_TRANS && !PL_lex_inpat && *s &&
strchr("lLuUEQ", *s)) {
                --s;
                break;
            }


Should cause the relevant escapes to pass through to the regex engine
where they could be handled by the regex parser.

cheers,
Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About