[PATCH B::Deparse] fix string uninterpretation
Robin Houston [Thu, 26 Apr 2001 17:13:41 +0000 (18:13 +0100)]
Date: Thu, 26 Apr 2001 17:13:41 +0100
Message-ID: <20010426171341.A27299@puffinry.freeserve.co.uk>

Subject: Re: [PATCH B::Deparse] fix string uninterpretation
From: Robin Houston <robin@kitsite.com>
Date: Thu, 26 Apr 2001 18:44:29 +0100
Message-ID: <20010426184429.A27734@puffinry.freeserve.co.uk>

p4raw-id: //depot/perl@9856

ext/B/B/Deparse.pm

index a96e3c2..7f6a321 100644 (file)
@@ -2754,15 +2754,15 @@ sub pp_enterwrite { unop(@_, "write") }
 # but not character escapes
 sub uninterp {
     my($str) = @_;
-    $str =~ s/(^|[^\\])([\$\@]|\\[uUlLQE])/$1\\$2/g;
+    $str =~ s/(^|\G|[^\\])((?:\\\\)*)([\$\%\@]|\\[uUlLQE])/$1$2\\$3/g;
     return $str;
 }
 
-# the same, but treat $|, $), and $ at the end of the string differently
+# the same, but treat $|, $), $( and $ at the end of the string differently
 sub re_uninterp {
     my($str) = @_;
-    $str =~ s/(^|[^\\])(\@|\\[uUlLQE])/$1\\$2/g;
-    $str =~ s/(^|[^\\])(\$[^)|])/$1\\$2/g;
+    $str =~ s/(^|\G|[^\\])((?:\\\\)*)([\$\%\@](?!\||\)|\$\(|$)|\\[uUlLQE])/$1$2\\$3/g
+;
     return $str;
 }