| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
=head1 NAME |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
PPIx::Regexp::Token::GroupType::NamedCapture - Represent a named capture |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use PPIx::Regexp::Dumper; |
|
8
|
|
|
|
|
|
|
PPIx::Regexp::Dumper->new( 'qr{(?<baz>foo)}smx' ) |
|
9
|
|
|
|
|
|
|
->print(); |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 INHERITANCE |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
C<PPIx::Regexp::Token::GroupType::NamedCapture> is a |
|
14
|
|
|
|
|
|
|
L<PPIx::Regexp::Token::GroupType|PPIx::Regexp::Token::GroupType>. |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
C<PPIx::Regexp::Token::GroupType::NamedCapture> has no descendants. |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
This class represents a named capture specification. Its content will be |
|
21
|
|
|
|
|
|
|
something like one of the following: |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
?<NAME> |
|
24
|
|
|
|
|
|
|
?'NAME' |
|
25
|
|
|
|
|
|
|
?P<NAME> |
|
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::Token::GroupType::NamedCapture; |
|
36
|
|
|
|
|
|
|
|
|
37
|
9
|
|
|
9
|
|
48
|
use strict; |
|
|
9
|
|
|
|
|
17
|
|
|
|
9
|
|
|
|
|
278
|
|
|
38
|
9
|
|
|
9
|
|
35
|
use warnings; |
|
|
9
|
|
|
|
|
18
|
|
|
|
9
|
|
|
|
|
342
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
9
|
|
|
9
|
|
117
|
use base qw{ PPIx::Regexp::Token::GroupType }; |
|
|
9
|
|
|
|
|
14
|
|
|
|
9
|
|
|
|
|
632
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
9
|
|
|
9
|
|
38
|
use Carp qw{ confess }; |
|
|
9
|
|
|
|
|
13
|
|
|
|
9
|
|
|
|
|
385
|
|
|
43
|
|
|
|
|
|
|
|
|
44
|
9
|
|
|
9
|
|
35
|
use PPIx::Regexp::Constant qw{ RE_CAPTURE_NAME @CARP_NOT }; |
|
|
9
|
|
|
|
|
932
|
|
|
|
9
|
|
|
|
|
899
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
our $VERSION = '0.091'; |
|
47
|
|
|
|
|
|
|
|
|
48
|
9
|
|
|
9
|
|
42
|
use constant TOKENIZER_ARGUMENT_REQUIRED => 1; |
|
|
9
|
|
|
|
|
13
|
|
|
|
9
|
|
|
|
|
2767
|
|
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub __new { |
|
51
|
34
|
|
|
34
|
|
130
|
my ( $class, $content, %arg ) = @_; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
defined $arg{perl_version_introduced} |
|
54
|
34
|
50
|
|
|
|
133
|
or $arg{perl_version_introduced} = '5.009005'; |
|
55
|
|
|
|
|
|
|
|
|
56
|
34
|
|
|
|
|
152
|
my $self = $class->SUPER::__new( $content, %arg ); |
|
57
|
|
|
|
|
|
|
|
|
58
|
34
|
|
|
|
|
113
|
foreach my $name ( $arg{tokenizer}->capture() ) { |
|
59
|
34
|
50
|
|
|
|
83
|
defined $name or next; |
|
60
|
34
|
|
|
|
|
95
|
$self->{name} = $name; |
|
61
|
34
|
|
|
|
|
107
|
return $self; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
0
|
confess 'Programming error - can not figure out capture name'; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# Return true if the token can be quantified, and false otherwise |
|
68
|
|
|
|
|
|
|
# sub can_be_quantified { return }; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub explain { |
|
71
|
1
|
|
|
1
|
1
|
3
|
my ( $self ) = @_; |
|
72
|
1
|
|
|
|
|
3
|
return sprintf q<Capture match into '%s'>, $self->name(); |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 name |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This method returns the name of the capture. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub name { |
|
82
|
33
|
|
|
33
|
1
|
58
|
my ( $self ) = @_; |
|
83
|
33
|
|
|
|
|
129
|
return $self->{name}; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub __make_group_type_matcher { |
|
87
|
|
|
|
|
|
|
return { |
|
88
|
9
|
|
|
9
|
|
79
|
'' => [ |
|
89
|
6
|
|
|
|
|
1076
|
qr/ \A [?] P? < ( @{[ RE_CAPTURE_NAME ]} ) > /smxo, |
|
90
|
6
|
|
|
|
|
591
|
qr/ \A [?] ' ( @{[ RE_CAPTURE_NAME ]} ) ' /smxo, |
|
91
|
|
|
|
|
|
|
], |
|
92
|
|
|
|
|
|
|
'?' => [ |
|
93
|
6
|
|
|
|
|
577
|
qr/ \A \\ [?] P? < ( @{[ RE_CAPTURE_NAME ]} ) > /smxo, |
|
94
|
6
|
|
|
|
|
489
|
qr/ \A \\ [?] ' ( @{[ RE_CAPTURE_NAME ]} ) ' /smxo, |
|
95
|
|
|
|
|
|
|
], |
|
96
|
|
|
|
|
|
|
q{'} => [ |
|
97
|
6
|
|
|
|
|
408
|
qr/ \A [?] P? < ( @{[ RE_CAPTURE_NAME ]} ) > /smxo, |
|
98
|
6
|
|
|
|
|
625
|
qr/ \A [?] \\ ' ( @{[ RE_CAPTURE_NAME ]} ) \\ ' /smxo, |
|
99
|
|
|
|
|
|
|
], |
|
100
|
|
|
|
|
|
|
}; |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
__END__ |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 SUPPORT |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Support is by the author. Please file bug reports at |
|
110
|
|
|
|
|
|
|
L<https://rt.cpan.org/Public/Dist/Display.html?Name=PPIx-Regexp>, |
|
111
|
|
|
|
|
|
|
L<https://github.com/trwyant/perl-PPIx-Regexp/issues>, or in |
|
112
|
|
|
|
|
|
|
electronic mail to the author. |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 AUTHOR |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Thomas R. Wyant, III F<wyant at cpan dot org> |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Copyright (C) 2009-2023, 2025 by Thomas R. Wyant, III |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
123
|
|
|
|
|
|
|
under the same terms as Perl 5.10.0. For more details, see the full text |
|
124
|
|
|
|
|
|
|
of the licenses in the directory LICENSES. |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but |
|
127
|
|
|
|
|
|
|
without any warranty; without even the implied warranty of |
|
128
|
|
|
|
|
|
|
merchantability or fitness for a particular purpose. |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
# ex: set textwidth=72 : |