From: Robin Houston Date: Thu, 5 Apr 2001 19:55:51 +0000 (+0100) Subject: regex quoting, and a minor milestone X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a0e66df8721677dce0bcba1a3283d09ec891916c;p=p5sagit%2Fp5-mst-13.2.git regex quoting, and a minor milestone Message-ID: <20010405195551.A16686@puffinry.freeserve.co.uk> p4raw-id: //depot/perl@9571 --- 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") {