This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
A B::Deparse fix from :
authorBas van Sisseren <bas@quarantainenet.nl>
Wed, 26 Oct 2005 13:59:42 +0000 (15:59 +0200)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Mon, 31 Oct 2005 17:00:44 +0000 (17:00 +0000)
Subject: Re: [perl #37527] regular-expression parser does not see '(' character
Message-ID: <435F6FAE.4060502@quarantainenet.nl>

p4raw-id: //depot/perl@25934

ext/B/B/Deparse.pm

index 3db6fbe..218ab9c 100644 (file)
@@ -19,7 +19,7 @@ use B qw(class main_root main_start main_cv svref_2object opnumber perlstring
          CVf_METHOD CVf_LOCKED CVf_LVALUE CVf_ASSERTION
         PMf_KEEP PMf_GLOBAL PMf_CONTINUE PMf_EVAL PMf_ONCE PMf_SKIPWHITE
         PMf_MULTILINE PMf_SINGLELINE PMf_FOLD PMf_EXTENDED);
-$VERSION = 0.71;
+$VERSION = 0.72;
 use strict;
 use vars qw/$AUTOLOAD/;
 use warnings ();
@@ -3369,14 +3369,16 @@ sub re_unback {
 sub balanced_delim {
     my($str) = @_;
     my @str = split //, $str;
-    my($ar, $open, $close, $fail, $c, $cnt);
+    my($ar, $open, $close, $fail, $c, $cnt, $last_bs);
     for $ar (['[',']'], ['(',')'], ['<','>'], ['{','}']) {
        ($open, $close) = @$ar;
-       $fail = 0; $cnt = 0;
+       $fail = 0; $cnt = 0; $last_bs = 0;
        for $c (@str) {
            if ($c eq $open) {
+               $fail = 1 if $last_bs;
                $cnt++;
            } elsif ($c eq $close) {
+               $fail = 1 if $last_bs;
                $cnt--;
                if ($cnt < 0) {
                    # qq()() isn't ")("
@@ -3384,6 +3386,7 @@ sub balanced_delim {
                    last;
                }
            }
+           $last_bs = $c eq '\\';
        }
        $fail = 1 if $cnt != 0;
        return ($open, "$open$str$close") if not $fail;