Regexp/Structure/CharClass.pm

filter: Statementstmt 90.6% 29 / 32 Branchbran 62.5% 5 / 8 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 90.0% 9 / 10 Podpod 100% 2 / 2 totaltotal 84.2% 48 / 57 CC 6 SCAR 9.6
CC
6
Cov
84%
explain
6.0
__new
4.0
negated
2.0
CRAP 2.6
« Regexp/Token.pm ↑ Summary Regexp/Structure/Code.pm »
1 =head1 NAME
2  
3 PPIx::Regexp::Structure::CharClass - Represent a character class
4  
5 =head1 SYNOPSIS
6  
7 use PPIx::Regexp::Dumper;
8 PPIx::Regexp::Dumper->new( 'qr{[fo]}smx' )
9 ->print();
10  
11 =head1 INHERITANCE
12  
13 C<PPIx::Regexp::Structure::CharClass> is a
14 L<PPIx::Regexp::Structure|PPIx::Regexp::Structure>.
15  
16 C<PPIx::Regexp::Structure::CharClass> has no descendants.
17  
18 =head1 DESCRIPTION
19  
20 This class represents a square-bracketed character class.
21  
22 =head1 METHODS
23  
24 This class provides the following public methods. Methods not documented
25 here are private, and unsupported in the sense that the author reserves
26 the right to change or remove them without notice.
27  
28 =cut
29  
30 package PPIx::Regexp::Structure::CharClass;
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 PPIx::Regexp::Constant qw{
Subroutine BEGIN: called CC=1 SCAR=0.0
38 LITERAL_LEFT_CURLY_REMOVED_PHASE_2
39 @CARP_NOT
40 9 };
41 9 ▶use PPIx::Regexp::Util qw{ :width_one __instance };
Subroutine BEGIN: called CC=1 SCAR=0.0
42  
43 9 our $VERSION = '0.092';
44  
45 37 ▶sub __new {
Subroutine __new: called CC=4 SCAR=14.0
46 37 my ( $class, @args ) = @_;
47 37 ▶ ref $class and $class = ref $class;
Branch: 1 branch
BranchTrueFalseTotal
ref $class and $class = ref $class 0 37 37
48 37 my %brkt;
49 37 $brkt{finish} = pop @args;
50 37 $brkt{start} = shift @args;
51 __instance( $args[0], 'PPIx::Regexp::Token::Operator' )
52 and $args[0]->content() eq '^'
53 37 ▶ and $brkt{type} = shift @args;
Branch: 1 branch
BranchTrueFalseTotal
__instance($args[0], "PPIx::Regexp::Token::Operator") and $args[0]->content eq "^" and $brkt{"type"} = shift @args 4 33 37
Condition66%2/3
__instance($args[0], "PPIx::Regexp::Token::Operator") and $args[0]->content eq "^"
!ll&&!rl&&r
3304
MC/DC50%1/2
__instance($args[0], "PPIx::Regexp::Token::Operator") and $args[0]->content eq "^"
__instance($args[0], "PPIx::Regexp::Token::Operator") $args[0]->content eq "^"
Truth table66%2/3
A and B
A= __instance($args[0], "PPIx::Regexp::Token::Operator")B= $args[0]->content eq "^"
ABresult
0X0
100
111
54 37 return $class->SUPER::__new( \%brkt, @args );
55 }
56  
57 0 ▶sub explain {
Subroutine explain: not called CC=2 SCAR=17.9
Pod documented
58 0 my ( $self ) = @_;
59 0 ▶ $self->negated()
Branch: 1 branch
BranchTrueFalseTotal
$self->negated and return "Inverted character class" 0 0 0
60 and return 'Inverted character class';
61 0 return 'Character class';
62 }
63  
64 =head2 negated
65  
66 $class->negated() and print "Class is negated\n";
67  
68 This method returns true if the character class is negated -- that is,
69 if the first token inside the left square bracket is a caret (C<^>).
70  
71 =cut
72  
73 2 ▶sub negated {
Subroutine negated: called CC=2 SCAR=6.9
Pod documented
74 2 my ( $self ) = @_;
75 2 ▶ return $self->type() ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->type ? : 1 1 2
76 }
77  
78 1 ▶sub __following_literal_left_curly_disallowed_in {
Subroutine __following_literal_left_curly_disallowed_in: called CC=1 SCAR=0.0
79 1 return LITERAL_LEFT_CURLY_REMOVED_PHASE_2;
80 }
81  
82 # Called by the lexer to record the capture number.
83 36 ▶sub __PPIX_LEXER__record_capture_number {
Subroutine __PPIX_LEXER__record_capture_number: called CC=1 SCAR=0.0
84 36 my ( undef, $number ) = @_; # Invocant unused
85 36 return $number;
86 }
87  
88 9 1;
89  
90 __END__
« Regexp/Token.pm ↑ Summary Regexp/Structure/Code.pm »