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 is a |
14
|
|
|
|
|
|
|
L. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
C is the parent of |
17
|
|
|
|
|
|
|
L. |
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
|
|
61
|
use strict; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
290
|
|
34
|
9
|
|
|
9
|
|
47
|
use warnings; |
|
9
|
|
|
|
|
280
|
|
|
9
|
|
|
|
|
291
|
|
35
|
|
|
|
|
|
|
|
36
|
9
|
|
|
9
|
|
60
|
use base qw{ PPIx::Regexp::Structure }; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
802
|
|
37
|
|
|
|
|
|
|
|
38
|
9
|
|
|
9
|
|
58
|
use PPIx::Regexp::Constant qw{ @CARP_NOT }; |
|
9
|
|
|
|
|
36
|
|
|
9
|
|
|
|
|
2214
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
our $VERSION = '0.087_01'; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub explain { |
43
|
2
|
|
|
2
|
1
|
7
|
my ( $self ) = @_; |
44
|
2
|
|
|
|
|
6
|
return sprintf q, $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. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub name { |
57
|
2
|
|
|
2
|
1
|
9
|
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
|
94
|
my ( $self ) = @_; |
71
|
44
|
|
|
|
|
180
|
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
|
|
248
|
my ( $self, $number ) = @_; |
77
|
91
|
|
|
|
|
303
|
$self->{number} = $number++; |
78
|
91
|
|
|
|
|
359
|
return $self->SUPER::__PPIX_LEXER__record_capture_number( $number ); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |