| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
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
|
|
|
9
|
|
44
|
use strict; |
|
|
9
|
|
|
|
|
11
|
|
|
|
9
|
|
|
|
|
285
|
|
|
34
|
9
|
|
|
9
|
|
32
|
use warnings; |
|
|
9
|
|
|
|
|
11
|
|
|
|
9
|
|
|
|
|
350
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
9
|
|
|
9
|
|
30
|
use base qw{ PPIx::Regexp::Structure }; |
|
|
9
|
|
|
|
|
10
|
|
|
|
9
|
|
|
|
|
633
|
|
|
37
|
|
|
|
|
|
|
|
|
38
|
9
|
|
|
9
|
|
34
|
use PPIx::Regexp::Constant qw{ @CARP_NOT }; |
|
|
9
|
|
|
|
|
12
|
|
|
|
9
|
|
|
|
|
1904
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
our $VERSION = '0.091'; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub explain { |
|
43
|
2
|
|
|
2
|
1
|
6
|
my ( $self ) = @_; |
|
44
|
2
|
|
|
|
|
7
|
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
|
|
|
2
|
1
|
5
|
return; |
|
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
|
|
|
44
|
1
|
65
|
my ( $self ) = @_; |
|
71
|
44
|
|
|
|
|
106
|
return $self->{number}; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# Called by the lexer to record the capture number. |
|
75
|
|
|
|
|
|
|
sub __PPIX_LEXER__record_capture_number { |
|
76
|
91
|
|
|
91
|
|
165
|
my ( $self, $number ) = @_; |
|
77
|
91
|
|
|
|
|
212
|
$self->{number} = $number++; |
|
78
|
91
|
|
|
|
|
255
|
return $self->SUPER::__PPIX_LEXER__record_capture_number( $number ); |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 SUPPORT |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Support is by the author. Please file bug reports at |
|
88
|
|
|
|
|
|
|
L<https://rt.cpan.org/Public/Dist/Display.html?Name=PPIx-Regexp>, |
|
89
|
|
|
|
|
|
|
L<https://github.com/trwyant/perl-PPIx-Regexp/issues>, or in |
|
90
|
|
|
|
|
|
|
electronic mail to the author. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 AUTHOR |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Thomas R. Wyant, III F<wyant at cpan dot org> |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Copyright (C) 2009-2023, 2025 by Thomas R. Wyant, III |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
101
|
|
|
|
|
|
|
under the same terms as Perl 5.10.0. For more details, see the full text |
|
102
|
|
|
|
|
|
|
of the licenses in the directory LICENSES. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but |
|
105
|
|
|
|
|
|
|
without any warranty; without even the implied warranty of |
|
106
|
|
|
|
|
|
|
merchantability or fitness for a particular purpose. |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# ex: set textwidth=72 : |