line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Regexp::Common::list; |
2
|
|
|
|
|
|
|
|
3
|
72
|
|
|
72
|
|
838
|
use 5.10.0; |
|
72
|
|
|
|
|
290
|
|
4
|
|
|
|
|
|
|
|
5
|
72
|
|
|
72
|
|
390
|
use strict; |
|
72
|
|
|
|
|
154
|
|
|
72
|
|
|
|
|
1425
|
|
6
|
72
|
|
|
72
|
|
376
|
use warnings; |
|
72
|
|
|
|
|
199
|
|
|
72
|
|
|
|
|
2044
|
|
7
|
72
|
|
|
72
|
|
367
|
no warnings 'syntax'; |
|
72
|
|
|
|
|
191
|
|
|
72
|
|
|
|
|
2674
|
|
8
|
|
|
|
|
|
|
|
9
|
72
|
|
|
72
|
|
1267
|
use Regexp::Common qw /pattern clean no_defaults/; |
|
72
|
|
|
|
|
161
|
|
|
72
|
|
|
|
|
458
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '2017060201'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub gen_list_pattern { |
14
|
8
|
|
|
8
|
0
|
25
|
my ($pat, $sep, $lsep) = @_; |
15
|
8
|
100
|
|
|
|
48
|
$lsep = $sep unless defined $lsep; |
16
|
8
|
|
|
|
|
40
|
return "(?k:(?:(?:$pat)(?:$sep))*(?:$pat)(?k:$lsep)(?:$pat))"; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $defpat = '.*?\S'; |
20
|
|
|
|
|
|
|
my $defsep = '\s*,\s*'; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
pattern name => ['list', "-pat=$defpat", "-sep=$defsep", '-lastsep'], |
23
|
|
|
|
|
|
|
create => sub {gen_list_pattern (@{$_[1]}{-pat, -sep, -lastsep})}, |
24
|
|
|
|
|
|
|
; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
pattern name => ['list', 'conj', '-word=(?:and|or)'], |
27
|
|
|
|
|
|
|
create => sub {gen_list_pattern($defpat, $defsep, |
28
|
|
|
|
|
|
|
'\s*,?\s*'.$_[1]->{-word}.'\s*'); |
29
|
|
|
|
|
|
|
}, |
30
|
|
|
|
|
|
|
; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
pattern name => ['list', 'and'], |
33
|
|
|
|
|
|
|
create => sub {gen_list_pattern ($defpat, $defsep, '\s*,?\s*and\s*')}, |
34
|
|
|
|
|
|
|
; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
pattern name => ['list', 'or'], |
37
|
|
|
|
|
|
|
create => sub {gen_list_pattern ($defpat, $defsep, '\s*,?\s*or\s*')}, |
38
|
|
|
|
|
|
|
; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |