This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
make Text::Balanced skip "case /..../" correctly for Switch.pm
authorDave Mitchell <davem@fdisolutions.com>
Sun, 16 May 2004 15:31:42 +0000 (15:31 +0000)
committerDave Mitchell <davem@fdisolutions.com>
Sun, 16 May 2004 15:31:42 +0000 (15:31 +0000)
p4raw-id: //depot/perl@22821

lib/Text/Balanced.pm
lib/Text/Balanced/t/extcbk.t

index 820ae25..8b390f7 100644 (file)
@@ -10,7 +10,7 @@ use Exporter;
 use SelfLoader;
 use vars qw { $VERSION @ISA %EXPORT_TAGS };
 
-$VERSION = '1.95';
+$VERSION = '1.95_01';
 @ISA           = qw ( Exporter );
                     
 %EXPORT_TAGS   = ( ALL => [ qw(
@@ -583,12 +583,15 @@ sub _match_codeblock($$$$$$$)
 
 
                # NEED TO COVER MANY MORE CASES HERE!!!
+               # NB 'case' is included here, because in Switch.pm,
+               # it's followed by a term, not an op
+
                if ($$textref =~ m#\G\s*(?!$ldel_inner)
                                        ( [-+*x/%^&|.]=?
                                        | [!=]~
                                        | =(?!>)
                                        | (\*\*|&&|\|\||<<|>>)=?
-                                       | split|grep|map|return
+                                       | case|split|grep|map|return
                                        | [([]
                                        )#gcx)
                {
index 47b0045..80553ab 100644 (file)
@@ -13,7 +13,7 @@ BEGIN {
 # Change 1..1 below to 1..last_test_to_print .
 # (It may become useful if the test is moved to ./t subdirectory.)
 
-BEGIN { $| = 1; print "1..41\n"; }
+BEGIN { $| = 1; print "1..43\n"; }
 END {print "not ok 1\n" unless $loaded;}
 use Text::Balanced qw ( extract_codeblock );
 $loaded = 1;
@@ -64,6 +64,7 @@ __DATA__
 
 # USING: extract_codeblock($str);
 { $data[4] =~ /['"]/; };
+{ case /^bar\s+\S+/ {\n#+\n}};
 
 # USING: extract_codeblock($str,'<>');
 < %x = ( try => "this") >;