develooper Front page | perl.perl5.porters | Postings from December 2001

[PATCH B::Dpparse] minor qr// fix

Thread Next
From:
Rafael Garcia-Suarez
Date:
December 20, 2001 13:52
Subject:
[PATCH B::Dpparse] minor qr// fix
Message ID:
20011220225334.A735@rafael
This patch makes B::Deparse avoid to use balanced delimiters for
the qr// operator.

One of the corrected problems is that qr/\[\]/ is currently deparsed
as qr[\[\]], which is equivalent to qr/[]/ (a syntax error).

Side-effect : t/op/tr.t now deparses correctly, slowly improving
the percentage of suceeding tests in 'make test.deparse'.


--- ext/B/B/Deparse.pm.orig	Mon Dec 17 19:33:27 2001
+++ ext/B/B/Deparse.pm	Thu Dec 20 22:42:08 2001
@@ -3158,10 +3158,11 @@
 sub single_delim {
     my($q, $default, $str) = @_;
     return "$default$str$default" if $default and index($str, $default) == -1;
-    my($succeed, $delim);
-    ($succeed, $str) = balanced_delim($str);
-    return "$q$str" if $succeed;
-    for $delim ('/', '"', '#') {
+    if ($q ne 'qr') {
+	(my $succeed, $str) = balanced_delim($str);
+	return "$q$str" if $succeed;
+    }
+    for my $delim ('/', '"', '#') {
 	return "$q$delim" . $str . $delim if index($str, $delim) == -1;
     }
     if ($default) {

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