Regexp/Structure/BranchReset.pm

filter: Statementstmt 100% 27 / 27 Branchbran 75.0% 6 / 8 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 91.3% 42 / 46 CC 7 SCAR 15.2
CC
7
Cov
92%
__PPIX_LEXER__record_capture_number
7.1
BEGIN
1.0
BEGIN
1.0
CRAP 4.6
« Regexp/Structure/Unknown.pm ↑ Summary Regexp/Token/CharClass/Simple.pm »
1 =head1 NAME
2  
3 PPIx::Regexp::Structure::BranchReset - Represent a branch reset group
4  
5 =head1 SYNOPSIS
6  
7 use PPIx::Regexp::Dumper;
8 PPIx::Regexp::Dumper->new( 'qr{(?|(foo)|(bar))}smx' )
9 ->print();
10  
11 =head1 INHERITANCE
12  
13 C<PPIx::Regexp::Structure::BranchReset> is a
14 L<PPIx::Regexp::Structure|PPIx::Regexp::Structure>.
15  
16 C<PPIx::Regexp::Structure::BranchReset> has no descendants.
17  
18 =head1 DESCRIPTION
19  
20 This class represents a branch reset group. That is, the construction
21 C<(?|(...)|(...)|...)>. This is new with Perl 5.010.
22  
23 =head1 METHODS
24  
25 This class provides no public methods beyond those provided by its
26 superclass.
27  
28 =cut
29  
30 package PPIx::Regexp::Structure::BranchReset;
31  
32 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
34  
35 9 ▶use base qw{ PPIx::Regexp::Structure };
Subroutine BEGIN: called CC=1 SCAR=0.0
36  
37 9 ▶use Carp qw{ confess };
Subroutine BEGIN: called CC=1 SCAR=0.0
38 9 ▶use PPIx::Regexp::Constant qw{ @CARP_NOT };
Subroutine BEGIN: called CC=1 SCAR=0.0
39  
40 9 our $VERSION = '0.092';
41  
42 # Called by the lexer to record the capture number.
43 6 ▶sub __PPIX_LEXER__record_capture_number {
Subroutine __PPIX_LEXER__record_capture_number: called CC=7 SCAR=19.7
44 6 my ( $self, $number ) = @_;
45 6 ▶ defined $number
Branch: 1 branch
BranchTrueFalseTotal
defined $number or confess("Programming error - initial \$number is undef") 6 0 6
46 or confess 'Programming error - initial $number is undef';
47 6 my $original = $number;
48 6 my $hiwater = $number;
49 6 foreach my $kid ( $self->children() ) {
50 16 ▶ if ( $kid->isa( 'PPIx::Regexp::Token::Operator' )
Branch: 1 branch
BranchTrueFalseTotal
if ($kid->isa('PPIx::Regexp::Token::Operator') and $kid->content eq '|') { } 5 11 16
Condition66%2/3
$kid->isa("PPIx::Regexp::Token::Operator") and $kid->content eq "|"
!ll&&!rl&&r
1105
MC/DC50%1/2
$kid->isa("PPIx::Regexp::Token::Operator") and $kid->content eq "|"
$kid->isa("PPIx::Regexp::Token::Operator") $kid->content eq "|"
Truth table66%2/3
A and B
A= $kid->isa("PPIx::Regexp::Token::Operator")B= $kid->content eq "|"
ABresult
0X0
100
111
51 && $kid->content() eq '|' ) {
52 5 ▶ $number > $hiwater and $hiwater = $number;
Branch: 1 branch
BranchTrueFalseTotal
$number > $hiwater and $hiwater = $number 5 0 5
53 5 $number = $original;
54 } else {
55 11 $number = $kid->__PPIX_LEXER__record_capture_number( $number );
56 }
57 }
58 6 ▶ return $number > $hiwater ? $number : $hiwater;
Branch: 1 branch
BranchTrueFalseTotal
$number > $hiwater ? : 1 5 6
59 }
60  
61 9 1;
62  
63 __END__
« Regexp/Structure/Unknown.pm ↑ Summary Regexp/Token/CharClass/Simple.pm »