blib/lib/PPIx/Regexp/Structure/Capture.pm

filter: Statementstmt 100% 22 / 22 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 3 / 3 totaltotal 100% 33 / 33 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/PPIx/Regexp/Structure/Atomic_Script_Run.pm ↑ Summary blib/lib/PPIx/Regexp/Structure/RegexSet.pm »
1 =head1 NAME
2  
3 PPIx::Regexp::Structure::Capture - Represent capture parentheses.
4  
5 =head1 SYNOPSIS
6  
7 use PPIx::Regexp::Dumper;
8 PPIx::Regexp::Dumper->new( 'qr{(foo)}smx' )
9 ->print();
10  
11 =head1 INHERITANCE
12  
13 C<PPIx::Regexp::Structure::Capture> is a
14 L<PPIx::Regexp::Structure|PPIx::Regexp::Structure>.
15  
16 C<PPIx::Regexp::Structure::Capture> is the parent of
17 L<PPIx::Regexp::Structure::NamedCapture|PPIx::Regexp::Structure::NamedCapture>.
18  
19 =head1 DESCRIPTION
20  
21 This class represents capture parentheses.
22  
23 =head1 METHODS
24  
25 This class provides the following public methods. Methods not documented
26 here are private, and unsupported in the sense that the author reserves
27 the right to change or remove them without notice.
28  
29 =cut
30  
31 package PPIx::Regexp::Structure::Capture;
32  
33 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 9 ▶use base qw{ PPIx::Regexp::Structure };
Subroutine BEGIN: called CC=1 SCAR=0.0
37  
38 9 ▶use PPIx::Regexp::Constant qw{ @CARP_NOT };
Subroutine BEGIN: called CC=1 SCAR=0.0
39  
40 9 our $VERSION = '0.091_01';
41  
42 sub explain {
43 2 ▶ my ( $self ) = @_;
Subroutine explain: called CC=1 SCAR=0.0
Pod documented
44 2 return sprintf q<Capture group number %s>, $self->number();
45 }
46  
47 =head2 name
48  
49 my $name = $element->name();
50  
51 This method returns the name of the capture buffer. Unless the buffer is
52 actually named, this will be C<undef>.
53  
54 =cut
55  
56 sub name {
57 2 ▶ return;
Subroutine name: called CC=1 SCAR=0.0
Pod documented
58 }
59  
60 =head2 number
61  
62 my $number = $element->number()
63  
64 This method returns the number of the capture buffer. Note that named
65 buffers have numbers also.
66  
67 =cut
68  
69 sub number {
70 44 ▶ my ( $self ) = @_;
Subroutine number: called CC=1 SCAR=0.0
Pod documented
71 44 return $self->{number};
72 }
73  
74 # Called by the lexer to record the capture number.
75 sub __PPIX_LEXER__record_capture_number {
76 91 ▶ my ( $self, $number ) = @_;
Subroutine __PPIX_LEXER__record_capture_number: called CC=1 SCAR=0.0
77 91 $self->{number} = $number++;
78 91 return $self->SUPER::__PPIX_LEXER__record_capture_number( $number );
79 }
80  
81 9 1;
82  
83 __END__
« blib/lib/PPIx/Regexp/Structure/Atomic_Script_Run.pm ↑ Summary blib/lib/PPIx/Regexp/Structure/RegexSet.pm »