| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
=head1 NAME |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Devel::PerlySense::Bookmark::MatchResult - A Bookmark definition and its matches |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
A Bookmark definition, and a list of matching Bookmark::Match objects |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=cut |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
63
|
|
|
63
|
|
212
|
use strict; |
|
|
63
|
|
|
|
|
80
|
|
|
|
63
|
|
|
|
|
1807
|
|
|
16
|
63
|
|
|
63
|
|
233
|
use warnings; |
|
|
63
|
|
|
|
|
78
|
|
|
|
63
|
|
|
|
|
2503
|
|
|
17
|
63
|
|
|
63
|
|
249
|
use utf8; |
|
|
63
|
|
|
|
|
92
|
|
|
|
63
|
|
|
|
|
301
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
package Devel::PerlySense::Bookmark::MatchResult; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
63
|
|
|
63
|
|
2229
|
use Spiffy -Base; |
|
|
63
|
|
|
|
|
88
|
|
|
|
63
|
|
|
|
|
270
|
|
|
26
|
63
|
|
|
63
|
|
44476
|
use Carp; |
|
|
63
|
|
|
63
|
|
732
|
|
|
|
63
|
|
|
63
|
|
1408
|
|
|
|
63
|
|
|
|
|
214
|
|
|
|
63
|
|
|
|
|
75
|
|
|
|
63
|
|
|
|
|
1246
|
|
|
|
63
|
|
|
|
|
242
|
|
|
|
63
|
|
|
|
|
81
|
|
|
|
63
|
|
|
|
|
3838
|
|
|
27
|
63
|
|
|
63
|
|
250
|
use Data::Dumper; |
|
|
63
|
|
|
|
|
107
|
|
|
|
63
|
|
|
|
|
2314
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
63
|
|
|
63
|
|
278
|
use Devel::PerlySense; |
|
|
63
|
|
|
|
|
93
|
|
|
|
63
|
|
|
|
|
378
|
|
|
30
|
63
|
|
|
63
|
|
12324
|
use Devel::PerlySense::Bookmark::Match; |
|
|
63
|
|
|
|
|
81
|
|
|
|
63
|
|
|
|
|
340
|
|
|
31
|
63
|
|
|
63
|
|
12241
|
use Devel::PerlySense::Bookmark::Definition; |
|
|
63
|
|
|
|
|
78
|
|
|
|
63
|
|
|
|
|
336
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 PROPERTIES |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 oDefinition |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Bookmark::Definition object. |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
|
44
|
|
|
|
|
|
|
field "oDefinition" => undef; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 raMatch |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Array ref with Bookmark::Match object. |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Default: [] |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
|
57
|
|
|
|
|
|
|
field "raMatch" => []; |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 METHODS |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 newFromMatch(oDefinition, file, source) |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Create new PerlySense::Bookmark::MatchResult object. Use $oDefinition |
|
68
|
|
|
|
|
|
|
to match against the $source in $file. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
If no matches were found, don't create the MatchResult object. Instead |
|
71
|
|
|
|
|
|
|
return undef (scalar context), or or an empty list (list context). |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Die on errors. |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
|
76
|
6
|
|
|
6
|
1
|
13
|
sub newFromMatch { |
|
77
|
6
|
|
|
|
|
24
|
my ($oDefinition, $file, $source) = Devel::PerlySense::Util::aNamedArg(["oDefinition", "file", "source"], @_); |
|
78
|
|
|
|
|
|
|
|
|
79
|
6
|
|
|
|
|
27
|
my @aMatch = $oDefinition->aMatch( |
|
80
|
|
|
|
|
|
|
file => $file, |
|
81
|
|
|
|
|
|
|
source => $source, |
|
82
|
|
|
|
|
|
|
); |
|
83
|
|
|
|
|
|
|
|
|
84
|
6
|
100
|
|
|
|
29
|
@aMatch or return; |
|
85
|
|
|
|
|
|
|
|
|
86
|
4
|
|
|
|
|
19
|
$self = bless {}, $self; #Create the object. It looks weird because of Spiffy |
|
87
|
|
|
|
|
|
|
|
|
88
|
4
|
|
|
|
|
104
|
$self->oDefinition($oDefinition); |
|
89
|
4
|
|
|
|
|
128
|
$self->raMatch(\@aMatch); |
|
90
|
|
|
|
|
|
|
|
|
91
|
4
|
|
|
|
|
43
|
return($self); |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 parseRex($rex) |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Perl eval the $rex string to create a qr// object and return it. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Die on eval errors, or if the result isn't a qr. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
|
105
|
0
|
|
|
0
|
1
|
|
sub parseRex { |
|
106
|
0
|
|
|
|
|
|
my ($rex) = @_; |
|
107
|
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
my $qr = eval $rex; ## no critic |
|
109
|
0
|
0
|
|
|
|
|
$@ and die("Perl syntax error encountered when parsing Bookmark regex ($rex):\n$@"); |
|
110
|
0
|
0
|
|
|
|
|
ref $qr eq "Regexp" or die("Bookmark regex definition ($rex) doesn't result in a regex (a qr// object)\n"); |
|
111
|
0
|
|
|
|
|
|
return $qr; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 aMatch(file, source) |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Return a Bookmark::Match object for each time this bookmark matches a |
|
121
|
|
|
|
|
|
|
line in source. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=cut |
|
124
|
0
|
|
|
0
|
1
|
|
sub aMatch { |
|
125
|
0
|
|
|
|
|
|
my ($file, $source) = Devel::PerlySense::Util::aNamedArg(["file", "source"], @_); |
|
126
|
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
my @aMatch; |
|
128
|
0
|
|
|
|
|
|
my $indexLine = 0; |
|
129
|
0
|
|
|
|
|
|
for my $line (split(/\n/, $source)) { |
|
130
|
0
|
|
|
|
|
|
$indexLine++; |
|
131
|
|
|
|
|
|
|
|
|
132
|
0
|
|
|
|
|
|
for my $rexText (@{$self->raRexText}) { |
|
|
0
|
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
|
my $qr = $self->rhQrRex->{$rexText}; |
|
134
|
|
|
|
|
|
|
|
|
135
|
0
|
0
|
|
|
|
|
if($line =~ $qr) { |
|
136
|
0
|
0
|
|
|
|
|
my $text = defined($1) ? $1 : $line; |
|
137
|
|
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
|
push( |
|
139
|
|
|
|
|
|
|
@aMatch, |
|
140
|
|
|
|
|
|
|
Devel::PerlySense::Bookmark::Match->new( |
|
141
|
|
|
|
|
|
|
oMatchResult => $self, |
|
142
|
|
|
|
|
|
|
file => $file, |
|
143
|
|
|
|
|
|
|
line => $line, |
|
144
|
|
|
|
|
|
|
text => $text, |
|
145
|
|
|
|
|
|
|
row => $indexLine, |
|
146
|
|
|
|
|
|
|
), |
|
147
|
|
|
|
|
|
|
); |
|
148
|
0
|
|
|
|
|
|
last; |
|
149
|
|
|
|
|
|
|
} |
|
150
|
|
|
|
|
|
|
} |
|
151
|
|
|
|
|
|
|
} |
|
152
|
|
|
|
|
|
|
|
|
153
|
0
|
|
|
|
|
|
return(@aMatch); |
|
154
|
|
|
|
|
|
|
} |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
1; |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
__END__ |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=encoding utf8 |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 AUTHOR |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Johan Lindström, C<< <johanl[ÄT]DarSerMan.com> >> |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 BUGS |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
|
177
|
|
|
|
|
|
|
C<bug-devel-perlysense@rt.cpan.org>, or through the web interface at |
|
178
|
|
|
|
|
|
|
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Devel-PerlySense>. |
|
179
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
|
180
|
|
|
|
|
|
|
your bug as I make changes. |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Copyright 2005 Johan Lindström, All Rights Reserved. |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
189
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=cut |