| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Switch::Perlish::Smatch::Regexp; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = '1.0.0'; |
|
4
|
|
|
|
|
|
|
|
|
5
|
11
|
|
|
11
|
|
151
|
use strict; |
|
|
11
|
|
|
|
|
22
|
|
|
|
11
|
|
|
|
|
509
|
|
|
6
|
11
|
|
|
11
|
|
57
|
use warnings; |
|
|
11
|
|
|
|
|
21
|
|
|
|
11
|
|
|
|
|
338
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
11
|
|
|
11
|
|
59
|
use Carp 'croak'; |
|
|
11
|
|
|
|
|
22
|
|
|
|
11
|
|
|
|
|
7554
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
## DESC - Match $t against $m. |
|
11
|
|
|
|
|
|
|
sub _VALUE { |
|
12
|
2
|
|
|
2
|
|
4
|
my($t, $m) = @_; |
|
13
|
2
|
|
|
|
|
22
|
return $m =~ $t; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
## DESC - croak("Can't compare Regexp with an undef") # Suggestions welcome. |
|
17
|
|
|
|
|
|
|
sub _UNDEF { |
|
18
|
1
|
|
|
1
|
|
275
|
croak("Can't compare Regexp with an undef"); |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
## DESC - Check if $m refers to $t. |
|
22
|
|
|
|
|
|
|
sub _SCALAR { |
|
23
|
2
|
|
|
2
|
|
5
|
my($t, $m) = @_; |
|
24
|
2
|
|
|
|
|
13
|
return $t == $$m; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
## DESC - Match $t for every element in @$m. |
|
28
|
|
|
|
|
|
|
sub _ARRAY { |
|
29
|
2
|
|
|
2
|
|
5
|
my($t, $m) = @_; |
|
30
|
|
|
|
|
|
|
$_ =~ $t and return 1 |
|
31
|
2
|
|
100
|
|
|
23
|
for @$m; |
|
32
|
|
|
|
|
|
|
return |
|
33
|
1
|
|
|
|
|
8
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
## DESC - Check if any of keys of %$m match the $t. |
|
36
|
|
|
|
|
|
|
sub _HASH { |
|
37
|
2
|
|
|
2
|
|
4
|
my($t, $m) = @_; |
|
38
|
|
|
|
|
|
|
$_ =~ $t and return 1 |
|
39
|
2
|
|
100
|
|
|
25
|
for keys %$m; |
|
40
|
1
|
|
|
|
|
8
|
return; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
## DESC - Pass $t to $m. |
|
44
|
|
|
|
|
|
|
sub _CODE { |
|
45
|
2
|
|
|
2
|
|
4
|
my($t, $m) = @_; |
|
46
|
2
|
|
|
|
|
9
|
return $m->($t); |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
## DESC - Match $t against $m's class. |
|
50
|
|
|
|
|
|
|
sub _OBJECT { |
|
51
|
2
|
|
|
2
|
|
4
|
my($t, $m) = @_; |
|
52
|
2
|
|
|
|
|
33
|
return ref($m) =~ $t; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
## DESC - Match $m to $t. |
|
56
|
|
|
|
|
|
|
sub _Regexp { |
|
57
|
2
|
|
|
2
|
|
4
|
my($t, $m) = @_; |
|
58
|
2
|
|
|
|
|
23
|
return $m =~ $t; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Switch::Perlish::Smatch->register_package( __PACKAGE__, 'Regexp' ); |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=pod |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 NAME |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Switch::Perlish::Smatch::Regexp - The C comparatory category package. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 VERSION |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1.0.0 - Initial release. |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This package provides the default implementation for the C comparator |
|
78
|
|
|
|
|
|
|
category. For more information on the comparator implementation see. |
|
79
|
|
|
|
|
|
|
L. |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 SEE. ALSO |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
L |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
L |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 AUTHOR |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Dan Brook C<< >> |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Copyright (c) 2006, Dan Brook. All Rights Reserved. This module is free |
|
94
|
|
|
|
|
|
|
software. It may be used, redistributed and/or modified under the same |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |