From a0e66df8721677dce0bcba1a3283d09ec891916c Mon Sep 17 00:00:00 2001 From: Robin Houston Date: Thu, 5 Apr 2001 20:55:51 +0100 Subject: [PATCH] regex quoting, and a minor milestone Message-ID: <20010405195551.A16686@puffinry.freeserve.co.uk> p4raw-id: //depot/perl@9571 --- ext/B/B/Deparse.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index b274dc0..49c0436 100644 --- a/ext/B/B/Deparse.pm +++ b/ext/B/B/Deparse.pm @@ -2710,9 +2710,15 @@ sub re_dq { my $op = shift; my $type = $op->name; if ($type eq "const") { - return uninterp($self->const_sv($op)->PV); + return re_uninterp($self->const_sv($op)->PV); } elsif ($type eq "concat") { - return $self->re_dq($op->first) . $self->re_dq($op->last); + my $first = $self->re_dq($op->first); + my $last = $self->re_dq($op->last); + # Disambiguate "${foo}bar", "${foo}{bar}", "${foo}[1]" + if ($last =~ /^[{\[\w]/) { + $first =~ s/([%\$@])([A-Za-z_]\w*)$/${1}{$2}/; + } + return $first . $last; } elsif ($type eq "uc") { return '\U' . $self->re_dq($op->first->sibling) . '\E'; } elsif ($type eq "lc") { -- 2.7.4