line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Amuse::Compile::Indexer::Specification; |
2
|
|
|
|
|
|
|
|
3
|
58
|
|
|
58
|
|
359
|
use strict; |
|
58
|
|
|
|
|
119
|
|
|
58
|
|
|
|
|
1504
|
|
4
|
58
|
|
|
58
|
|
256
|
use warnings; |
|
58
|
|
|
|
|
109
|
|
|
58
|
|
|
|
|
1147
|
|
5
|
58
|
|
|
58
|
|
266
|
use Moo; |
|
58
|
|
|
|
|
121
|
|
|
58
|
|
|
|
|
304
|
|
6
|
58
|
|
|
58
|
|
16424
|
use Types::Standard qw/Str ArrayRef StrMatch HashRef/; |
|
58
|
|
|
|
|
133
|
|
|
58
|
|
|
|
|
364
|
|
7
|
58
|
|
|
58
|
|
40433
|
use Data::Dumper; |
|
58
|
|
|
|
|
127
|
|
|
58
|
|
|
|
|
18645
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=encoding utf8 |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Text::Amuse::Compile::Indexer::Specification - Class for LaTeX indexes |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Everything here is pretty much private and used by L |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 ACCESSORS AND METHODS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=over 4 |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=item index_name |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
The index code. Must be ASCII, letters only. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=item index_label |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
The index title. Must be an escaped LaTeX string |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=item patterns |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
The raw patterns, with C sequence. They are LaTeX |
34
|
|
|
|
|
|
|
strings. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=item matches |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Lazily built, a sorted arrayref with hashrefs with the matching |
39
|
|
|
|
|
|
|
specification. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=item total_found |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Read-write accessor for counting (used by L) |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=back |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
has index_name => (is => 'ro', |
54
|
|
|
|
|
|
|
required => 1, |
55
|
|
|
|
|
|
|
isa => StrMatch[qr{\A[a-z]+\z}], |
56
|
|
|
|
|
|
|
); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
has index_label => (is => 'ro', |
59
|
|
|
|
|
|
|
required => 1, |
60
|
|
|
|
|
|
|
isa => Str, |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
has patterns => (is => 'ro', |
64
|
|
|
|
|
|
|
required => 1, |
65
|
|
|
|
|
|
|
isa => ArrayRef[Str]); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
has matches => (is => 'lazy', isa => ArrayRef[HashRef]); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
has total_found => (is => 'rw', default => sub { 0 }); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub _build_matches { |
72
|
11
|
|
|
11
|
|
1223
|
my $self = shift; |
73
|
11
|
|
|
|
|
20
|
my @patterns = @{$self->patterns}; |
|
11
|
|
|
|
|
61
|
|
74
|
11
|
|
|
|
|
190
|
my @pairs; |
75
|
11
|
|
|
|
|
29
|
foreach my $str (@patterns) { |
76
|
45
|
|
|
|
|
149
|
my ($match, $label) = split(/\s*:\s*/, $str, 2); |
77
|
|
|
|
|
|
|
# default to label |
78
|
45
|
|
66
|
|
|
143
|
$label ||= $match; |
79
|
45
|
|
|
|
|
134
|
push @pairs, { |
80
|
|
|
|
|
|
|
match => $match, |
81
|
|
|
|
|
|
|
label => $label, |
82
|
|
|
|
|
|
|
}; |
83
|
|
|
|
|
|
|
} |
84
|
11
|
|
|
|
|
182
|
return \@pairs; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |