line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
PPIx::Regexp::Structure::NamedCapture - Represent a named capture |
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 is a |
14
|
|
|
|
|
|
|
L. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
C has no descendants. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
This class represents a named capture. Its content will be something |
21
|
|
|
|
|
|
|
like one of the following: |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
(? ... ) |
24
|
|
|
|
|
|
|
(?'NAME' ... ) |
25
|
|
|
|
|
|
|
(?P ... ) |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 METHODS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
This class provides the following public methods. Methods not documented |
30
|
|
|
|
|
|
|
here are private, and unsupported in the sense that the author reserves |
31
|
|
|
|
|
|
|
the right to change or remove them without notice. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
package PPIx::Regexp::Structure::NamedCapture; |
36
|
|
|
|
|
|
|
|
37
|
9
|
|
|
9
|
|
77
|
use strict; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
273
|
|
38
|
9
|
|
|
9
|
|
45
|
use warnings; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
217
|
|
39
|
|
|
|
|
|
|
|
40
|
9
|
|
|
9
|
|
40
|
use Carp; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
487
|
|
41
|
|
|
|
|
|
|
|
42
|
9
|
|
|
9
|
|
63
|
use base qw{ PPIx::Regexp::Structure::Capture }; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
842
|
|
43
|
|
|
|
|
|
|
|
44
|
9
|
|
|
9
|
|
64
|
use PPIx::Regexp::Constant qw{ @CARP_NOT }; |
|
9
|
|
|
|
|
24
|
|
|
9
|
|
|
|
|
2067
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
our $VERSION = '0.087'; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub explain { |
49
|
1
|
|
|
1
|
1
|
4
|
my ( $self ) = @_; |
50
|
1
|
|
|
|
|
4
|
return sprintf q, |
51
|
|
|
|
|
|
|
$self->name(), $self->number(); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 name |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $name = $element->name(); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This method returns the name of the capture. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub name { |
63
|
29
|
|
|
29
|
1
|
102
|
my ( $self ) = @_; |
64
|
29
|
50
|
|
|
|
146
|
my $type = $self->type() |
65
|
|
|
|
|
|
|
or croak 'Programming error - ', __PACKAGE__, ' without type object'; |
66
|
29
|
|
|
|
|
173
|
return $type->name(); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |