line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Regexp::Whitespace; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
85487
|
use 5.008; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
79
|
|
5
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
71
|
|
6
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
340
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.001_0'; |
9
|
|
|
|
|
|
|
our @ISA; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
BEGIN { |
12
|
2
|
|
|
2
|
|
138
|
@ISA = qw( Regexp ); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
|
1085
|
use Regexp::Whitespace::Builder (); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
57
|
|
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
2343
|
use Attribute::Memoize; |
|
2
|
|
|
|
|
18208
|
|
|
2
|
|
|
|
|
87
|
|
18
|
2
|
|
|
2
|
|
24
|
use Scalar::Util qw( refaddr ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
326
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use overload |
21
|
2
|
|
|
|
|
26
|
'""' => \&to_s, |
22
|
2
|
|
|
2
|
|
13
|
fallback => 1; |
|
2
|
|
|
|
|
6
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new { |
25
|
16
|
|
|
16
|
0
|
19483
|
my $self = shift; |
26
|
16
|
|
33
|
|
|
117
|
my $proto = ref $self || $self; |
27
|
16
|
|
|
|
|
3054
|
my $qr = $self->_factory->build(@_); |
28
|
16
|
|
|
|
|
36
|
my $s = "$qr"; |
29
|
16
|
|
|
|
|
41
|
bless $qr, $proto; |
30
|
16
|
|
|
|
|
73
|
$qr->raw( qq{/$_[0]/w} ); # FIXME |
31
|
16
|
|
|
|
|
46
|
$qr->_re_string( $s ); # FIXME |
32
|
16
|
|
|
|
|
53
|
return $qr; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _factory :Memoize { |
36
|
1
|
|
|
|
|
43
|
return 'Regexp::Whitespace::Builder'; |
37
|
2
|
|
|
2
|
|
411
|
} |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
10
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
{ |
40
|
|
|
|
|
|
|
# FIXME an incomplete inside-out approach |
41
|
|
|
|
|
|
|
my %raw_of; |
42
|
|
|
|
|
|
|
my %string_of; # I am using this because I could not |
43
|
|
|
|
|
|
|
# invoke the default Regexp stringification |
44
|
|
|
|
|
|
|
# after blessing |
45
|
|
|
|
|
|
|
sub raw { |
46
|
29
|
|
|
29
|
0
|
49
|
my $self = shift; |
47
|
29
|
100
|
|
|
|
89
|
if ( @_ ) { |
48
|
16
|
|
|
|
|
81
|
$raw_of{refaddr $self} = shift; |
49
|
|
|
|
|
|
|
} |
50
|
29
|
|
|
|
|
313
|
return $raw_of{refaddr $self}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
# the stringfication of the underlying regex |
53
|
|
|
|
|
|
|
sub _re_string { |
54
|
30
|
|
|
30
|
|
257
|
my $self = shift; |
55
|
30
|
100
|
|
|
|
78
|
if ( @_ ) { |
56
|
16
|
|
|
|
|
52
|
$string_of{refaddr $self} = shift; |
57
|
|
|
|
|
|
|
} |
58
|
30
|
|
|
|
|
177
|
return $string_of{refaddr $self}; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
# FIXME: needs DESTROY |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub to_s { |
64
|
13
|
|
|
13
|
0
|
178
|
return shift->raw; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
#sub import { |
69
|
|
|
|
|
|
|
# use overload; |
70
|
|
|
|
|
|
|
# |
71
|
|
|
|
|
|
|
# overload::constant |
72
|
|
|
|
|
|
|
# qr => sub { |
73
|
|
|
|
|
|
|
# my ($raw) = @_; |
74
|
|
|
|
|
|
|
# ... |
75
|
|
|
|
|
|
|
# }; |
76
|
|
|
|
|
|
|
#} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |