line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Amuse::Compile::Indexer::Specification; |
2
|
|
|
|
|
|
|
|
3
|
58
|
|
|
58
|
|
368
|
use strict; |
|
58
|
|
|
|
|
121
|
|
|
58
|
|
|
|
|
1505
|
|
4
|
58
|
|
|
58
|
|
310
|
use warnings; |
|
58
|
|
|
|
|
145
|
|
|
58
|
|
|
|
|
1197
|
|
5
|
58
|
|
|
58
|
|
268
|
use Moo; |
|
58
|
|
|
|
|
156
|
|
|
58
|
|
|
|
|
290
|
|
6
|
58
|
|
|
58
|
|
16615
|
use Types::Standard qw/Str ArrayRef StrMatch HashRef/; |
|
58
|
|
|
|
|
182
|
|
|
58
|
|
|
|
|
422
|
|
7
|
58
|
|
|
58
|
|
40760
|
use Data::Dumper; |
|
58
|
|
|
|
|
155
|
|
|
58
|
|
|
|
|
19355
|
|
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
|
|
1221
|
my $self = shift; |
73
|
11
|
|
|
|
|
23
|
my @patterns = @{$self->patterns}; |
|
11
|
|
|
|
|
50
|
|
74
|
11
|
|
|
|
|
36
|
my @pairs; |
75
|
11
|
|
|
|
|
27
|
foreach my $str (@patterns) { |
76
|
45
|
|
|
|
|
137
|
my ($match, $label) = split(/\s*:\s*/, $str, 2); |
77
|
|
|
|
|
|
|
# default to label |
78
|
45
|
|
66
|
|
|
154
|
$label ||= $match; |
79
|
45
|
|
|
|
|
130
|
push @pairs, { |
80
|
|
|
|
|
|
|
match => $match, |
81
|
|
|
|
|
|
|
label => $label, |
82
|
|
|
|
|
|
|
}; |
83
|
|
|
|
|
|
|
} |
84
|
11
|
|
|
|
|
166
|
return \@pairs; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |