line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Amuse::Compile::Indexer::Specification; |
2
|
|
|
|
|
|
|
|
3
|
59
|
|
|
59
|
|
449
|
use strict; |
|
59
|
|
|
|
|
173
|
|
|
59
|
|
|
|
|
1750
|
|
4
|
59
|
|
|
59
|
|
322
|
use warnings; |
|
59
|
|
|
|
|
144
|
|
|
59
|
|
|
|
|
1380
|
|
5
|
59
|
|
|
59
|
|
323
|
use Moo; |
|
59
|
|
|
|
|
150
|
|
|
59
|
|
|
|
|
327
|
|
6
|
59
|
|
|
59
|
|
19033
|
use Types::Standard qw/Str ArrayRef StrMatch HashRef/; |
|
59
|
|
|
|
|
164
|
|
|
59
|
|
|
|
|
406
|
|
7
|
59
|
|
|
59
|
|
48383
|
use Data::Dumper; |
|
59
|
|
|
|
|
171
|
|
|
59
|
|
|
|
|
21253
|
|
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
|
|
1493
|
my $self = shift; |
73
|
11
|
|
|
|
|
30
|
my @patterns = @{$self->patterns}; |
|
11
|
|
|
|
|
69
|
|
74
|
11
|
|
|
|
|
24
|
my @pairs; |
75
|
11
|
|
|
|
|
31
|
foreach my $str (@patterns) { |
76
|
45
|
|
|
|
|
169
|
my ($match, $label) = split(/\s*:\s*/, $str, 2); |
77
|
|
|
|
|
|
|
# default to label |
78
|
45
|
|
66
|
|
|
166
|
$label ||= $match; |
79
|
45
|
|
|
|
|
162
|
push @pairs, { |
80
|
|
|
|
|
|
|
match => $match, |
81
|
|
|
|
|
|
|
label => $label, |
82
|
|
|
|
|
|
|
}; |
83
|
|
|
|
|
|
|
} |
84
|
11
|
|
|
|
|
200
|
return \@pairs; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |