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
|
|
67
|
use strict; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
358
|
|
34
|
9
|
|
|
9
|
|
48
|
use warnings; |
|
9
|
|
|
|
|
333
|
|
|
9
|
|
|
|
|
302
|
|
35
|
|
|
|
|
|
|
|
36
|
9
|
|
|
9
|
|
49
|
use base qw{ PPIx::Regexp::Structure }; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
739
|
|
37
|
|
|
|
|
|
|
|
38
|
9
|
|
|
9
|
|
62
|
use PPIx::Regexp::Constant qw{ @CARP_NOT }; |
|
9
|
|
|
|
|
38
|
|
|
9
|
|
|
|
|
2308
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
our $VERSION = '0.087'; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub explain { |
43
|
2
|
|
|
2
|
1
|
6
|
my ( $self ) = @_; |
44
|
2
|
|
|
|
|
7
|
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
|
6
|
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
|
106
|
my ( $self ) = @_; |
71
|
44
|
|
|
|
|
155
|
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
|
|
234
|
my ( $self, $number ) = @_; |
77
|
91
|
|
|
|
|
285
|
$self->{number} = $number++; |
78
|
91
|
|
|
|
|
351
|
return $self->SUPER::__PPIX_LEXER__record_capture_number( $number ); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |