line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
PPIx::Regexp::Structure::Modifier - Represent modifying parentheses |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use PPIx::Regexp::Dumper; |
8
|
|
|
|
|
|
|
PPIx::Regexp::Dumper->new( 'qr{(?i: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 parentheses that apply modifiers to their contents |
21
|
|
|
|
|
|
|
-- even if there are no modifiers. The latter is to say that C<(?:foo)> |
22
|
|
|
|
|
|
|
also ends up as this class. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 METHODS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
This class provides no public methods beyond those provided by its |
27
|
|
|
|
|
|
|
superclass. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
package PPIx::Regexp::Structure::Modifier; |
32
|
|
|
|
|
|
|
|
33
|
9
|
|
|
9
|
|
58
|
use strict; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
258
|
|
34
|
9
|
|
|
9
|
|
49
|
use warnings; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
248
|
|
35
|
|
|
|
|
|
|
|
36
|
9
|
|
|
9
|
|
41
|
use base qw{ PPIx::Regexp::Structure }; |
|
9
|
|
|
|
|
45
|
|
|
9
|
|
|
|
|
688
|
|
37
|
|
|
|
|
|
|
|
38
|
9
|
|
|
9
|
|
57
|
use PPIx::Regexp::Constant qw{ @CARP_NOT }; |
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
1861
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
our $VERSION = '0.087_01'; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# This is a kluge for both determining whether the object asserts |
43
|
|
|
|
|
|
|
# modifiers (hence the 'ductype') and determining whether the given |
44
|
|
|
|
|
|
|
# modifier is actually asserted. The signature is the invocant and the |
45
|
|
|
|
|
|
|
# modifier name, which must not be undef. The return is a boolean. |
46
|
|
|
|
|
|
|
sub __ducktype_modifier_asserted { |
47
|
2
|
|
|
2
|
|
6
|
my ( $self, $modifier ) = @_; |
48
|
2
|
|
|
|
|
13
|
foreach my $type ( reverse $self->type() ) { |
49
|
2
|
50
|
|
|
|
14
|
$type->can( '__ducktype_modifier_asserted' ) |
50
|
|
|
|
|
|
|
or next; |
51
|
2
|
50
|
|
|
|
8
|
defined( my $val = $type->__ducktype_modifier_asserted( $modifier ) ) |
52
|
|
|
|
|
|
|
or next; |
53
|
2
|
|
|
|
|
14
|
return $val; |
54
|
|
|
|
|
|
|
} |
55
|
0
|
|
|
|
|
|
return; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |