line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
1054
|
use strict; use warnings; |
|
2
|
|
|
2
|
|
4
|
|
|
2
|
|
|
|
|
64
|
|
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
161
|
|
2
|
|
|
|
|
|
|
package Perl::Tags::Naive::Moose; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
40
|
use parent 'Perl::Tags::Naive'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
13
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.32'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head2 C<get_parsers> |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
The following parsers are defined by this module. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=over 4 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub get_parsers |
17
|
|
|
|
|
|
|
{ |
18
|
5
|
|
|
5
|
1
|
8
|
my $self = shift; |
19
|
|
|
|
|
|
|
return ( |
20
|
5
|
|
|
|
|
18
|
$self->SUPER::get_parsers(), |
21
|
|
|
|
|
|
|
$self->can('extends_line'), |
22
|
|
|
|
|
|
|
$self->can('with_line'), |
23
|
|
|
|
|
|
|
$self->can('has_line'), |
24
|
|
|
|
|
|
|
$self->can('around_line'), |
25
|
|
|
|
|
|
|
$self->can('before_line'), |
26
|
|
|
|
|
|
|
$self->can('after_line'), |
27
|
|
|
|
|
|
|
$self->can('override_line'), |
28
|
|
|
|
|
|
|
$self->can('augment_line'), |
29
|
|
|
|
|
|
|
$self->can('class_line'), |
30
|
|
|
|
|
|
|
$self->can('method_line'), |
31
|
|
|
|
|
|
|
$self->can('role_line'), |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=item C<extends_line> |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Parse the declaration of a 'extends' Moose keyword, returning a L<Perl::Tags::Tag::Extends> if found. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub extends_line { |
42
|
36
|
|
|
36
|
1
|
43
|
my ($self, $line, $statement, $file) = @_; |
43
|
36
|
100
|
|
|
|
68
|
if ($statement=~/extends\s+["']?((?:\w+|::)+)\b/) { |
44
|
1
|
|
|
|
|
5
|
return Perl::Tags::Tag::Recurse->new( |
45
|
|
|
|
|
|
|
name => $1, |
46
|
|
|
|
|
|
|
line => 'dummy', |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
} |
49
|
35
|
|
|
|
|
61
|
return; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item C<with_line> |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Parse the declaration of a 'with' Moose keyword, returning a L<Perl::Tags::Tag::With> tag if found. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub with_line { |
59
|
36
|
|
|
36
|
1
|
39
|
my ( $self, $line, $statement, $file ) = @_; |
60
|
36
|
100
|
|
|
|
117
|
if ( $statement =~ m/\bwith\s+(?:qw.)?\W*([a-zA-Z0-9_: ]+)/ ) { |
61
|
2
|
|
|
|
|
5
|
my @roles = split /\s+/, $1; |
62
|
2
|
|
|
|
|
2
|
my @returns; |
63
|
2
|
|
|
|
|
3
|
foreach my $role (@roles) { |
64
|
3
|
|
|
|
|
15
|
push @returns, Perl::Tags::Tag::Recurse->new( |
65
|
|
|
|
|
|
|
name => $role, |
66
|
|
|
|
|
|
|
line => 'dummy', |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
} |
69
|
2
|
|
|
|
|
6
|
return @returns; |
70
|
|
|
|
|
|
|
} |
71
|
34
|
|
|
|
|
63
|
return; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item C<has_line> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Parse the declaration of a 'has' Moose keyword, returning a L<Perl::Tags::Tag::Has> if found. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub has_line { |
81
|
36
|
|
|
36
|
1
|
42
|
my ($self, $line, $statement, $file) = @_; |
82
|
36
|
100
|
|
|
|
66
|
if ($statement=~/\bhas\s+["']?(\w+)\b/) { |
83
|
|
|
|
|
|
|
return ( |
84
|
2
|
|
|
|
|
17
|
Perl::Tags::Tag::Has->new( |
85
|
|
|
|
|
|
|
name => $1, |
86
|
|
|
|
|
|
|
file => $file, |
87
|
|
|
|
|
|
|
line => $line, |
88
|
|
|
|
|
|
|
linenum => $., |
89
|
|
|
|
|
|
|
) |
90
|
|
|
|
|
|
|
); |
91
|
|
|
|
|
|
|
} |
92
|
34
|
|
|
|
|
54
|
return; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item C<around_line> |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Parse the declaration of a 'around' Moose keyword, returning a L<Perl::Tags::Tag::Around> tag if found. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub around_line { |
102
|
36
|
|
|
36
|
1
|
43
|
my ($self, $line, $statement, $file) = @_; |
103
|
36
|
50
|
|
|
|
59
|
if ($statement=~/around\s+["'](\w+)\b/) { |
104
|
|
|
|
|
|
|
return ( |
105
|
0
|
|
|
|
|
0
|
Perl::Tags::Tag::Around->new( |
106
|
|
|
|
|
|
|
name => $1, |
107
|
|
|
|
|
|
|
file => $file, |
108
|
|
|
|
|
|
|
line => $line, |
109
|
|
|
|
|
|
|
linenum => $., |
110
|
|
|
|
|
|
|
) |
111
|
|
|
|
|
|
|
); |
112
|
|
|
|
|
|
|
} |
113
|
36
|
|
|
|
|
61
|
return; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item C<before_line> |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Parse the declaration of a 'before' Moose keyword, returning a L<Perl::Tags::Tag::Before> tag if found. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub before_line { |
123
|
36
|
|
|
36
|
1
|
42
|
my ($self, $line, $statement, $file) = @_; |
124
|
36
|
50
|
|
|
|
94
|
if ($statement=~/before\s+["'](\w+)\b/) { |
125
|
|
|
|
|
|
|
return ( |
126
|
0
|
|
|
|
|
0
|
Perl::Tags::Tag::Before->new( |
127
|
|
|
|
|
|
|
name => $1, |
128
|
|
|
|
|
|
|
file => $file, |
129
|
|
|
|
|
|
|
line => $line, |
130
|
|
|
|
|
|
|
linenum => $., |
131
|
|
|
|
|
|
|
) |
132
|
|
|
|
|
|
|
); |
133
|
|
|
|
|
|
|
} |
134
|
36
|
|
|
|
|
60
|
return; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item C<after_line> |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Parse the declaration of a 'after' Moose keyword, returning a L<Perl::Tags::Tag::After> tag if found. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub after_line { |
144
|
36
|
|
|
36
|
1
|
70
|
my ($self, $line, $statement, $file) = @_; |
145
|
36
|
50
|
|
|
|
58
|
if ($statement=~/after\s+["'](\w+)\b/) { |
146
|
|
|
|
|
|
|
return ( |
147
|
0
|
|
|
|
|
0
|
Perl::Tags::Tag::After->new( |
148
|
|
|
|
|
|
|
name => $1, |
149
|
|
|
|
|
|
|
file => $file, |
150
|
|
|
|
|
|
|
line => $line, |
151
|
|
|
|
|
|
|
linenum => $., |
152
|
|
|
|
|
|
|
) |
153
|
|
|
|
|
|
|
); |
154
|
|
|
|
|
|
|
} |
155
|
36
|
|
|
|
|
62
|
return; |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=item C<override_line> |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Parse the declaration of a 'override' Moose keyword, returning a L<Perl::Tags::Tag::Override> tag if found. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=cut |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
sub override_line { |
165
|
36
|
|
|
36
|
1
|
42
|
my ($self, $line, $statement, $file) = @_; |
166
|
36
|
50
|
|
|
|
62
|
if ($statement=~/override\s+["'](\w+)\b/) { |
167
|
|
|
|
|
|
|
return ( |
168
|
0
|
|
|
|
|
0
|
Perl::Tags::Tag::Override->new( |
169
|
|
|
|
|
|
|
name => $1, |
170
|
|
|
|
|
|
|
file => $file, |
171
|
|
|
|
|
|
|
line => $line, |
172
|
|
|
|
|
|
|
linenum => $., |
173
|
|
|
|
|
|
|
) |
174
|
|
|
|
|
|
|
); |
175
|
|
|
|
|
|
|
} |
176
|
36
|
|
|
|
|
63
|
return; |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item C<augment_line> |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Parse the declaration of a 'augment' Moose keyword, returning a L<Perl::Tags::Tag::Augment> tag if found. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=cut |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
sub augment_line { |
186
|
36
|
|
|
36
|
1
|
46
|
my ($self, $line, $statement, $file) = @_; |
187
|
36
|
50
|
|
|
|
66
|
if ($statement=~/augment\s+["']?(\w+)\b/) { |
188
|
|
|
|
|
|
|
return ( |
189
|
0
|
|
|
|
|
0
|
Perl::Tags::Tag::Augment->new( |
190
|
|
|
|
|
|
|
name => $1, |
191
|
|
|
|
|
|
|
file => $file, |
192
|
|
|
|
|
|
|
line => $line, |
193
|
|
|
|
|
|
|
linenum => $., |
194
|
|
|
|
|
|
|
) |
195
|
|
|
|
|
|
|
); |
196
|
|
|
|
|
|
|
} |
197
|
36
|
|
|
|
|
67
|
return; |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=item C<class_line> |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
Parse the declaration of a 'class' Moose keyword, returning a L<Perl::Tags::Tag::Class> tag if found. |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=cut |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
sub class_line { |
207
|
36
|
|
|
36
|
1
|
46
|
my ($self, $line, $statement, $file) = @_; |
208
|
36
|
50
|
|
|
|
59
|
if ($statement=~/class\s+(\w+)\b/) { |
209
|
|
|
|
|
|
|
return ( |
210
|
0
|
|
|
|
|
0
|
Perl::Tags::Tag::Class->new( |
211
|
|
|
|
|
|
|
name => $1, |
212
|
|
|
|
|
|
|
file => $file, |
213
|
|
|
|
|
|
|
line => $line, |
214
|
|
|
|
|
|
|
linenum => $., |
215
|
|
|
|
|
|
|
) |
216
|
|
|
|
|
|
|
); |
217
|
|
|
|
|
|
|
} |
218
|
36
|
|
|
|
|
62
|
return; |
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=item C<method_line> |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
Parse the declaration of a 'method' Moose keyword, returning a L<Perl::Tags::Tag::Method> tag if found. |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=cut |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
sub method_line { |
228
|
36
|
|
|
36
|
1
|
40
|
my ($self, $line, $statement, $file) = @_; |
229
|
36
|
50
|
|
|
|
85
|
if ($statement=~/method\s+(\w+)\b/) { |
230
|
|
|
|
|
|
|
return ( |
231
|
0
|
|
|
|
|
0
|
Perl::Tags::Tag::Method->new( |
232
|
|
|
|
|
|
|
name => $1, |
233
|
|
|
|
|
|
|
file => $file, |
234
|
|
|
|
|
|
|
line => $line, |
235
|
|
|
|
|
|
|
linenum => $., |
236
|
|
|
|
|
|
|
) |
237
|
|
|
|
|
|
|
); |
238
|
|
|
|
|
|
|
} |
239
|
36
|
|
|
|
|
61
|
return; |
240
|
|
|
|
|
|
|
} |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=item C<role_line> |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
Parse the declaration of a 'role' Moose keyword, returning a L<Perl::Tags::Tag::Role> tag if found. |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=cut |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
sub role_line { |
249
|
36
|
|
|
36
|
1
|
38
|
my ($self, $line, $statement, $file) = @_; |
250
|
36
|
50
|
|
|
|
67
|
if ($statement=~/role\s+(\w+)\b/) { |
251
|
|
|
|
|
|
|
return ( |
252
|
0
|
|
|
|
|
0
|
Perl::Tags::Tag::Role->new( |
253
|
|
|
|
|
|
|
name => $1, |
254
|
|
|
|
|
|
|
file => $file, |
255
|
|
|
|
|
|
|
line => $line, |
256
|
|
|
|
|
|
|
linenum => $., |
257
|
|
|
|
|
|
|
) |
258
|
|
|
|
|
|
|
); |
259
|
|
|
|
|
|
|
} |
260
|
36
|
|
|
|
|
57
|
return; |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=head1 C<Perl::Tags::Tag::Method> |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=head2 C<type>: Method |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=cut |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
package Perl::Tags::Tag::Method; |
270
|
|
|
|
|
|
|
our @ISA = qw/Perl::Tags::Tag::Sub/; |
271
|
|
|
|
|
|
|
|
272
|
0
|
|
|
0
|
|
0
|
sub type { 'Method' } |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=head1 C<Perl::Tags::Tag::Has> |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=head2 C<type>: Has |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=cut |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
package Perl::Tags::Tag::Has; |
282
|
|
|
|
|
|
|
our @ISA = qw/Perl::Tags::Tag::Method/; |
283
|
|
|
|
|
|
|
|
284
|
2
|
|
|
2
|
|
5
|
sub type { 'Has' } |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=head1 C<Perl::Tags::Tag::Around> |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=head2 C<type>: Around |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=cut |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
package Perl::Tags::Tag::Around; |
293
|
|
|
|
|
|
|
our @ISA = qw/Perl::Tags::Tag::Method/; |
294
|
|
|
|
|
|
|
|
295
|
0
|
|
|
0
|
|
|
sub type { 'Around' } |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=head1 C<Perl::Tags::Tag::Before> |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=head2 C<type>: Before |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=cut |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
package Perl::Tags::Tag::Before; |
304
|
|
|
|
|
|
|
our @ISA = qw/Perl::Tags::Tag::Method/; |
305
|
|
|
|
|
|
|
|
306
|
0
|
|
|
0
|
|
|
sub type { 'Before' } |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
=head1 C<Perl::Tags::Tag::After> |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
=head2 C<type>: After |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
=cut |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
package Perl::Tags::Tag::After; |
315
|
|
|
|
|
|
|
our @ISA = qw/Perl::Tags::Tag::Method/; |
316
|
|
|
|
|
|
|
|
317
|
0
|
|
|
0
|
|
|
sub type { 'After' } |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=head1 C<Perl::Tags::Tag::Override> |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=head2 C<type>: Override |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=cut |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
package Perl::Tags::Tag::Override; |
326
|
|
|
|
|
|
|
our @ISA = qw/Perl::Tags::Tag::Method/; |
327
|
|
|
|
|
|
|
|
328
|
0
|
|
|
0
|
|
|
sub type { 'Override' } |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
=head1 C<Perl::Tags::Tag::Augment> |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
=head2 C<type>: Augment |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
=cut |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
package Perl::Tags::Tag::Augment; |
337
|
|
|
|
|
|
|
our @ISA = qw/Perl::Tags::Tag::Method/; |
338
|
|
|
|
|
|
|
|
339
|
0
|
|
|
0
|
|
|
sub type { 'Augment' } |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
=head1 C<Perl::Tags::Tag::Class> |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
=head2 C<type>: Class |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
=cut |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
package Perl::Tags::Tag::Class; |
348
|
|
|
|
|
|
|
our @ISA = qw/Perl::Tags::Tag::Package/; |
349
|
|
|
|
|
|
|
|
350
|
0
|
|
|
0
|
|
|
sub type { 'Class' } |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
=head1 C<Perl::Tags::Tag::Role> |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
=head2 C<type>: Role |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
=cut |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
package Perl::Tags::Tag::Role; |
359
|
|
|
|
|
|
|
our @ISA = qw/Perl::Tags::Tag::Package/; |
360
|
|
|
|
|
|
|
|
361
|
0
|
|
|
0
|
|
|
sub type { 'Role' } |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
1; |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
=head1 AUTHOR and LICENSE |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
dr bean - drbean at sign cpan a dot org |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
This is licensed under the same terms as Perl itself. (Or as Vim if you +prefer). |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
=cut |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
|