Ita2heb/LettersSeq/IT/ToHeb.pm

filter: Statementstmt 99.0% 202 / 204 Branchbran 98.6% 73 / 74 Conditioncond 91.6% 33 / 36 MC/DCmcdc 85.0% 17 / 20 Subroutinesub 97.7% 43 / 44 Podpod 100% 12 / 12 totaltotal 97.4% 380 / 390 CC 51 SCAR 12.0
CC
51
Cov
98%
_handle_letter_i
8.0
should_add_dagesh
6.0
main_loop
5.0
CRAP 3.3
« Ita2heb/LettersSeq/IT.pm ↑ Summary Ita2heb/LettersSeq.pm »
1 package Lingua::IT::Ita2heb::LettersSeq::IT::ToHeb;
2  
3 11 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 11 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 11 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 11 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 11 extends(
13 'Lingua::IT::Ita2heb::LettersSeq::IT'
14 );
15  
16 11 with( 'Lingua::IT::Ita2heb::Role::Constants::Hebrew' );
17  
18 11 has total_text =>
19 (
20 is => 'ro',
21 isa => 'Str',
22 traits => ['String'],
23 default => q{},
24 handles =>
25 {
26 main_add => 'append',
27 },
28 );
29  
30 11 has next_letter_error_code =>
31 (
32 is => 'ro',
33 isa => 'Str',
34 default => 'NEXT_LETTER',
35 );
36  
37 11 has all_hebrew_vowels =>
38 (
39 is => 'ro',
40 isa => 'ArrayRef[Str]',
41 lazy_build => 1,
42 );
43  
44 11 has disable_rafe => (
45 is => 'ro',
46 isa => 'Bool',
47 );
48  
49 11 has ascii_geresh => (
50 is => 'ro',
51 isa => 'Bool',
52 );
53  
54 11 has ascii_maqaf => (
55 is => 'ro',
56 isa => 'Bool',
57 );
58  
59 11 has disable_dagesh => (
60 is => 'ro',
61 isa => 'Bool',
62 traits => ['Bool'],
63 handles => {
64 dagesh_enabled => 'not',
65 },
66 );
67  
68 11 has '_simple_trs' => (
69 is => 'ro',
70 isa => 'HashRef[Str]',
71 lazy_build => 1,
72 );
73  
74 95 ▶sub _build__simple_trs {
Subroutine _build__simple_trs: called CC=1 SCAR=0.0
75 95 my $seq = shift;
76  
77 return +{
78 'b' => $seq->heb('BET'),
79 'd' => $seq->heb('DALET'),
80 285 (map { $_ => $seq->heb('SEGOL') } @{$seq->types_of_e}),
81 'k' => $seq->heb('QOF'),
82 'l' => $seq->heb('LAMED'),
83 95 (map { $_ => $seq->heb('HOLAM_MALE') } @{$seq->types_of_o}),
84 'p' => $seq->heb('PE'),
85 'r' => $seq->heb('RESH'),
86 't' => $seq->heb('TET'),
87 'x' => $seq->heb('SHIN'), # This isn't right, of course
88 };
89 }
90  
91 11 has special_words => (
92 is => 'ro',
93 isa => 'HashRef[Str]',
94 );
95  
96 0 ▶sub _build_special_words {
Subroutine _build_special_words: not called CC=1 SCAR=6.9
97 0 my ($seq) = @_;
98  
99 return {
100 0 Roma => $seq->heb('RESH,VAV,HOLAM,MEM,QAMATS,ALEF'),
101 };
102 }
103  
104 11 has _geresh => (
105 is => 'ro',
106 isa => 'Str',
107 lazy_build => 1,
108 );
109  
110 14 ▶sub _build__geresh {
Subroutine _build__geresh: called CC=2 SCAR=6.9
111 14 my ($seq) = @_;
112  
113 14 ▶ return $seq->ascii_geresh ? q{'} : $seq->heb('TRUE_GERESH');
Branch: 1 branch
BranchTrueFalseTotal
$seq->ascii_geresh ? : 1 13 14
114 }
115  
116 11 has handled_letters => (
117 isa => 'HashRef[Str]',
118 is => 'ro',
119 lazy_build => 1,
120 );
121  
122 95 ▶sub _build_handled_letters {
Subroutine _build_handled_letters: called CC=1 SCAR=0.0
123 95 my $seq = shift;
124  
125 950 return +{ (map { $_ => "_handle_letter_$_" } qw(c f g h m n q s v z)),
126 190 (map { $_ => "_handle_letter_a" } @{$seq->types_of_a}),
127 570 (map { $_ => "_handle_letter_i" } @{$seq->types_of_i}),
128 285 (map { $_ => "_handle_letter_u" } @{$seq->types_of_u}),
129 1330 (map { $_ => "_handle_simple_tr_letter" }
130 95 keys(%{$seq->_simple_trs})
131 ),
132 };
133 }
134  
135 95 ▶sub _build_all_hebrew_vowels {
Subroutine _build_all_hebrew_vowels: called CC=1 SCAR=0.0
136 95 my ($self) = @_;
137 95 return [ $self->list_heb( qw( QAMATS HATAF_QAMATS PATAH HATAF_PATAH
138 TSERE SEGOL HATAF_SEGOL HIRIQ HIRIQ_MALE HOLAM HOLAM_MALE QUBUTS SHURUK)
139 ) ];
140 }
141  
142 35 ▶sub add_heb_final {
Subroutine add_heb_final: called CC=1 SCAR=0.0
Pod documented
143 35 my ($seq, @args) = @_;
144  
145 35 return $seq->add_final(map { $seq->heb($_) } @args);
146 }
147  
148 222 ▶sub add_heb {
Subroutine add_heb: called CC=1 SCAR=0.0
Pod documented
149 222 my ($seq, $latinized_spec) = @_;
150  
151 222 return $seq->add( $seq->heb( $latinized_spec ) );
152 }
153  
154 87 ▶sub _main_add_heb {
Subroutine _main_add_heb: called CC=1 SCAR=0.0
155 87 my ($seq, $latinized_spec) = @_;
156  
157 87 return $seq->main_add( $seq->heb( $latinized_spec ) );
158 }
159  
160 381 ▶sub handle_letter {
Subroutine handle_letter: called CC=1 SCAR=0.0
Pod documented
161 381 my ($seq, $letter) = @_;
162  
163 381 my $meth = $seq->handled_letters->{$letter};
164  
165 381 return $seq->$meth($letter);
166 }
167  
168 147 ▶sub _handle_simple_tr_letter {
Subroutine _handle_simple_tr_letter: called CC=1 SCAR=0.0
169 147 my ($seq, $letter) = @_;
170  
171 147 $seq->add( $seq->_simple_trs->{$letter} );
172  
173 147 return;
174 }
175  
176 62 ▶sub _handle_letter_a {
Subroutine _handle_letter_a: called CC=2 SCAR=6.9
177 62 my ($seq) = @_;
178  
179 62 ▶ $seq->add_heb($seq->closed_syllable ? 'PATAH' : 'QAMATS');
Branch: 1 branch
BranchTrueFalseTotal
$seq->closed_syllable ? : 18 44 62
180  
181 62 return;
182 }
183  
184 26 ▶sub _handle_letter_c {
Subroutine _handle_letter_c: called CC=4 SCAR=13.9
185 26 my ($seq) = @_;
186  
187 26 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
unless ($seq->match_before([["s"]]) and $seq->match_cg_mod_after([])) 23 3 26
Condition66%2/3
$seq->match_before([["s"]]) and $seq->match_cg_mod_after([])
!ll&&!rl&&r
2303
MC/DC50%1/2
$seq->match_before([["s"]]) and $seq->match_cg_mod_after([])
$seq->match_before([["s"]]) $seq->match_cg_mod_after([])
Truth table66%2/3
A and B
A= $seq->match_before([["s"]])B= $seq->match_cg_mod_after([])
ABresult
0X0
100
111
188 not( $seq->match_before([['s']])
189 and $seq->match_cg_mod_after([]))
190 )
191 {
192 23 ▶ $seq->add_heb(
Branch: 1 branch
BranchTrueFalseTotal
$seq->set_optional_cg_geresh([['c']]) ? : 10 13 23
193 $seq->set_optional_cg_geresh([['c']]) ? 'TSADI' : 'QOF'
194 );
195 }
196
197 26 return;
198 }
199  
200 5 ▶sub _handle_letter_f {
Subroutine _handle_letter_f: called CC=4 SCAR=13.9
201 5 my ($seq) = @_;
202  
203 5 ▶ if (! $seq->add_heb_final('PE', 'FINAL_PE')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($seq->add_heb_final("PE", "FINAL_PE")) 4 1 5
204 4 ▶ if ($seq->at_start and not $seq->disable_rafe)
Branch: 1 branch
BranchTrueFalseTotal
if ($seq->at_start and not $seq->disable_rafe) 3 1 4
Condition66%2/3
$seq->at_start and not $seq->disable_rafe
!ll&&!rl&&r
013
MC/DC50%1/2
$seq->at_start and not $seq->disable_rafe
$seq->at_start not $seq->disable_rafe
Truth table66%2/3
A and not(B)
A= $seq->at_startB= not $seq->disable_rafe
ABresult
0X0
100
111
205 {
206 3 $seq->add_heb('RAFE');
207 }
208 }
209  
210 5 return;
211 }
212  
213 15 ▶sub _handle_letter_g {
Subroutine _handle_letter_g: called CC=4 SCAR=13.9
214 15 my ($seq) = @_;
215  
216 15 $seq->set_optional_cg_geresh([['g']]);
217  
218 15 ▶ if ($seq->match_after([['n']]))
Branch: 2 branches
BranchTrueFalseTotal
if ($seq->match_after([['n']])) { } 5 10 15
elsif (not $seq->after_start && $seq->match_after([['l']])) { } 9 1 10
219 {
220 5 $seq->add_heb('NUN,SHEVA,YOD');
221 }
222 ▶ elsif (
Condition100%3/3
$seq->after_start && $seq->match_after([['l']])
!ll&&!rl&&r
541
MC/DC100%2/2
$seq->after_start && $seq->match_after([['l']])
$seq->after_start $seq->match_after([['l']])
Truth table100%3/3
A && B
A= $seq->after_startB= $seq->match_after([['l']])
ABresult
0X0
100
111
223 not(
224 $seq->after_start
225 and $seq->match_after([['l']])
226 )
227 )
228 {
229 9 $seq->add_heb('GIMEL');
230 }
231  
232 15 return;
233 }
234  
235 1 ▶sub _handle_letter_h {
Subroutine _handle_letter_h: called CC=1 SCAR=0.0
236 1 return; # Niente.
237 }
238  
239 42 ▶sub _handle_letter_i {
Subroutine _handle_letter_i: called CC=8 SCAR=20.8
240 42 my ($seq) = @_;
241  
242 42 ▶ if ( # No [i] in sci, except end of word
Branch: 1 branch
BranchTrueFalseTotal
unless ($seq->before_end and $seq->match_before([["s"], ["c"]])) 41 1 42
Condition100%3/3
$seq->before_end and $seq->match_before([["s"], ["c"]])
!ll&&!rl&&r
8331
MC/DC100%2/2
$seq->before_end and $seq->match_before([["s"], ["c"]])
$seq->before_end $seq->match_before([["s"], ["c"]])
Truth table100%3/3
A and B
A= $seq->before_endB= $seq->match_before([["s"], ["c"]])
ABresult
0X0
100
111
243 not(
244 $seq->before_end
245 and $seq->match_before([['s'],['c']])
246 )
247 )
248 {
249 41 ▶ if ($seq->should_add_geresh) {
Branch: 2 branches
BranchTrueFalseTotal
if ($seq->should_add_geresh) { } 15 26 41
elsif ($seq->match_vowel_after) { } 7 19 26
250 15 ▶ if (not $seq->match_vowel_after )
Branch: 1 branch
BranchTrueFalseTotal
unless ($seq->match_vowel_after) 4 11 15
251 {
252 4 $seq->add_heb('HIRIQ')
253 }
254 }
255 elsif ($seq->match_vowel_after)
256 {
257 7 ▶ if ( $seq->at_start
Branch: 1 branch
BranchTrueFalseTotal
if ($seq->at_start or $seq->match_vowel_before) { } 2 5 7
Condition100%3/3
$seq->at_start or $seq->match_vowel_before
l!l&&r!l&&!r
115
MC/DC100%2/2
$seq->at_start or $seq->match_vowel_before
$seq->at_start $seq->match_vowel_before
Truth table100%3/3
A or B
A= $seq->at_startB= $seq->match_vowel_before
ABresult
1X1
011
000
258 or $seq->match_vowel_before) {
259 2 $seq->add_heb('YOD')
260 }
261 else {
262 5 $seq->add_heb('SHEVA,YOD')
263 }
264 }
265 else {
266 19 $seq->add_heb('HIRIQ_MALE')
267 }
268 }
269  
270 42 return;
271 }
272  
273 18 ▶sub _handle_letter_n {
Subroutine _handle_letter_n: called CC=2 SCAR=6.9
274 18 my ($seq) = @_;
275  
276 18 ▶ if ( $seq->match_before([['g']]) )
Branch: 1 branch
BranchTrueFalseTotal
if ($seq->match_before([["g"]])) 5 13 18
277 {
278 5 return $seq->next_letter_error_code;
279 }
280  
281 13 $seq->add_heb_final('NUN', 'FINAL_NUN');
282  
283 13 return;
284 }
285  
286 15 ▶sub _handle_letter_m {
Subroutine _handle_letter_m: called CC=1 SCAR=0.0
287 15 my ($seq) = @_;
288  
289 15 $seq->add_heb_final('MEM', 'FINAL_MEM');
290  
291 15 return;
292 }
293  
294 4 ▶sub _handle_letter_q {
Subroutine _handle_letter_q: called CC=3 SCAR=11.0
295 4 my ($seq) = @_;
296  
297 4 ▶ if ( $seq->match_before([['c']]) )
Branch: 1 branch
BranchTrueFalseTotal
if ($seq->match_before([['c']])) { } 2 2 4
298 {
299 2 ▶ if ($seq->dagesh_enabled) {
Branch: 1 branch
BranchTrueFalseTotal
if ($seq->dagesh_enabled) 1 1 2
300 1 $seq->add_heb('DAGESH');
301 }
302 }
303 else {
304 2 $seq->add_heb('QOF');
305 }
306  
307 4 $seq->add_heb('SHEVA,VAV');
308  
309 4 return;
310 }
311  
312 16 ▶sub _handle_letter_s {
Subroutine _handle_letter_s: called CC=4 SCAR=13.9
313 16 my ($seq) = @_;
314  
315 16 ▶ if ( $seq->match_vowel_before
Branch: 2 branches
BranchTrueFalseTotal
if ($seq->match_vowel_before and $seq->match_vowel_after) { } 2 14 16
elsif ($seq->match_cg_mod_after([['c']])) { } 3 11 14
Condition100%3/3
$seq->match_vowel_before and $seq->match_vowel_after
!ll&&!rl&&r
1132
MC/DC100%2/2
$seq->match_vowel_before and $seq->match_vowel_after
$seq->match_vowel_before $seq->match_vowel_after
Truth table100%3/3
A and B
A= $seq->match_vowel_beforeB= $seq->match_vowel_after
ABresult
0X0
100
111
316 and $seq->match_vowel_after
317 )
318 {
319 2 $seq->add_heb('ZAYIN');
320 }
321 elsif ($seq->match_cg_mod_after([['c']]))
322 {
323 3 $seq->add_heb('SHIN');
324 }
325 else {
326 11 $seq->add_heb('SAMEKH');
327 }
328  
329 16 return;
330 }
331  
332 15 ▶sub _handle_letter_u {
Subroutine _handle_letter_u: called CC=2 SCAR=6.9
333 15 my ($seq) = @_;
334  
335 15 ▶ if ($seq->match_before([['q']]))
Branch: 1 branch
BranchTrueFalseTotal
if ($seq->match_before([['q']])) { } 4 11 15
336 {
337 4 return $seq->next_letter_error_code;
338 }
339 else {
340 11 $seq->add_heb('SHURUK');
341 }
342  
343 11 return;
344 }
345  
346 11 ▶sub _handle_letter_v {
Subroutine _handle_letter_v: called CC=2 SCAR=6.9
347 11 my ($seq) = @_;
348  
349 11 ▶ $seq->add_heb($seq->does_v_require_bet ? 'BET' : 'VAV');
Branch: 1 branch
BranchTrueFalseTotal
$seq->does_v_require_bet ? : 6 5 11
350  
351 11 return;
352 }
353  
354 4 ▶sub _handle_letter_z {
Subroutine _handle_letter_z: called CC=2 SCAR=6.9
355 4 my ($seq) = @_;
356  
357 4 ▶ if ($seq->at_start) {
Branch: 1 branch
BranchTrueFalseTotal
if ($seq->at_start) { } 2 2 4
358 2 $seq->add_heb('DALET,DAGESH,SHEVA,ZAYIN');
359 }
360 else {
361 2 $seq->add_heb_final('TSADI', 'FINAL_TSADI');
362 }
363  
364 4 return;
365 }
366  
367 {
368 11 my %map = (map { $_ => 1 } qw(b p));
369  
370 384 ▶ sub requires_dagesh_phonetic {
Subroutine requires_dagesh_phonetic: called CC=1 SCAR=0.0
Pod documented
371 384 my ($seq) = @_;
372  
373 384 return exists($map{$seq->current});
374 }
375 }
376  
377 11 ▶sub _to_add_in {
Subroutine _to_add_in: called CC=1 SCAR=0.0
378 848 my ($seq, $letters_aref) = @_;
379  
380 848 return ($seq->text_to_add ~~ $letters_aref);
381 }
382  
383 {
384 # Dagesh qal.
385 # BET and PE must not change according to these rules in transliterated
386 # Italian and KAF and TAV are not needed in Italian at all.
387 # Dagesh qal in GIMEL and DALET is totally artificial, but it's part
388 # of the standard...
389  
390 11 my @REQUIRES_DAGESH_LENE = __PACKAGE__->list_heb( qw(GIMEL DALET) );
391  
392 245 ▶ sub text_to_add_requires_dagesh_lene {
Subroutine text_to_add_requires_dagesh_lene: called CC=1 SCAR=0.0
Pod documented
393 245 return shift->_to_add_in(\@REQUIRES_DAGESH_LENE);
394 }
395 }
396  
397 11 ▶sub should_add_dagesh {
Subroutine should_add_dagesh: called CC=6 SCAR=17.9
Pod documented
398 373 my ($seq) = @_;
399  
400 return
401 (
402 373 ▶ $seq->requires_dagesh_phonetic
Condition93%14/15
$seq->requires_dagesh_phonetic || $seq->geminated && $seq->dagesh_enabled || !$seq->match_vowel_before && $seq->text_to_add_requires_dagesh_lene && !$seq->requires_dagesh_phonetic
l!l&&r!l&&!r
3411328
$seq->requires_dagesh_phonetic or $seq->geminated and $seq->dagesh_enabled
l!l&&r!l&&!r
1519339
$seq->geminated and $seq->dagesh_enabled
!ll&&!rl&&r
337219
not $seq->match_vowel_before and $seq->text_to_add_requires_dagesh_lene and not $seq->requires_dagesh_phonetic
!ll&&!rl&&r
328011
not $seq->match_vowel_before and $seq->text_to_add_requires_dagesh_lene
!ll&&!rl&&r
9423411
MC/DC83%5/6
$seq->requires_dagesh_phonetic || $seq->geminated && $seq->dagesh_enabled || !$seq->match_vowel_before && $seq->text_to_add_requires_dagesh_lene && !$seq->requires_dagesh_phonetic
$seq->requires_dagesh_phonetic $seq->geminated $seq->dagesh_enabled not $seq->match_vowel_before $seq->text_to_add_requires_dagesh_lene not $seq->requires_dagesh_phonetic
Truth table60%6/10
A or B and C || not(D) and E and not(F)
A= $seq->requires_dagesh_phoneticB= $seq->geminatedC= $seq->dagesh_enabledD= not $seq->match_vowel_beforeE= $seq->text_to_add_requires_dagesh_leneF= not $seq->requires_dagesh_phonetic
ABCDEFresult
1XXXXX1
011XXX1
00X1111
0101111
00X0XX0
00X10X0
00X1100
0100XX0
01010X0
0101100
403 or
404 ($seq->geminated and $seq->dagesh_enabled) # Dagesh geminating
405 or
406 (
407 (not $seq->match_vowel_before)
408 and $seq->text_to_add_requires_dagesh_lene
409 and (not $seq->requires_dagesh_phonetic)
410 )
411 );
412 }
413  
414 373 ▶sub add_dagesh_if_needed {
Subroutine add_dagesh_if_needed: called CC=3 SCAR=11.0
Pod documented
415 373 my ($seq) = @_;
416  
417 373 ▶ if ( $seq->should_add_dagesh )
Branch: 1 branch
BranchTrueFalseTotal
if ($seq->should_add_dagesh) 45 328 373
418 {
419 45 ▶ if (! $seq->_to_add_in([$seq->heb('RESH')])) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($seq->_to_add_in([$seq->heb("RESH")])) 43 2 45
420 43 $seq->add_heb('DAGESH');
421 }
422  
423 45 $seq->unset_geminated;
424 }
425  
426 373 return;
427 }
428  
429 746 ▶sub _add_geresh_cond {
Subroutine _add_geresh_cond: called CC=2 SCAR=6.9
430 746 my ($seq, $letters_aref) = @_;
431  
432 746 ▶ return ($seq->should_add_geresh and $seq->_to_add_in($letters_aref));
Condition100%3/3
$seq->should_add_geresh && $seq->_to_add_in($letters_aref)
!ll&&!rl&&r
6666416
MC/DC100%2/2
$seq->should_add_geresh && $seq->_to_add_in($letters_aref)
$seq->should_add_geresh $seq->_to_add_in($letters_aref)
Truth table100%3/3
A && B
A= $seq->should_add_gereshB= $seq->_to_add_in($letters_aref)
ABresult
0X0
100
111
433 }
434  
435 382 ▶sub perform_switch {
Subroutine perform_switch: called CC=3 SCAR=11.0
Pod documented
436 382 my ($seq) = @_;
437  
438 382 my $letter = $seq->current;
439  
440 382 ▶ if ( exists($seq->handled_letters->{$letter}) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $seq->handled_letters->{$letter}) { } 381 1 382
441 381 ▶ if (defined ( my $error_code = $seq->handle_letter($letter) ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $error_code = $seq->handle_letter($letter))) 9 372 381
442 9 return $error_code;
443 }
444 }
445 else {
446 1 $seq->add(q{?});
447 1 carp('Unknown letter ' . $seq->current . ' in the source.');
448 }
449  
450 373 return;
451 }
452  
453 16 ▶sub _add_geresh_to_text {
Subroutine _add_geresh_to_text: called CC=1 SCAR=0.0
454 16 my ($seq) = @_;
455  
456 16 $seq->main_add( $seq->_geresh );
457  
458 16 return;
459 }
460  
461 10 ▶sub _before_geresh_helper {
Subroutine _before_geresh_helper: called CC=2 SCAR=6.9
462 10 my ($seq) = @_;
463  
464 10 ▶ if ($seq->_to_add_in([$seq->heb('HIRIQ')])) {
Branch: 1 branch
BranchTrueFalseTotal
if ($seq->_to_add_in([$seq->heb("HIRIQ")])) 4 6 10
465 4 $seq->_main_add_heb( 'YOD' );
466 }
467  
468 10 return;
469 }
470  
471  
472 746 ▶sub _on_geresh {
Subroutine _on_geresh: called CC=2 SCAR=6.9
473 746 my ($seq, $letters_aref, $callback) = @_;
474  
475 746 ▶ if ($seq->_add_geresh_cond($letters_aref)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($seq->_add_geresh_cond($letters_aref)) 16 730 746
476 16 $seq->_add_geresh_to_text;
477 16 $seq->unset_add_geresh;
478  
479 16 $seq->$callback();
480 }
481  
482 746 return;
483 }
484  
485 {
486 11 my @VOWEL_AFTER_GERESH = __PACKAGE__->list_heb( qw(HOLAM_MALE SHURUK) );
487  
488 11 my @VOWEL_BEFORE_GERESH = __PACKAGE__->list_heb(
489 qw(QAMATS PATAH TSERE SEGOL HIRIQ)
490 );
491  
492 373 ▶ sub after_switch {
Subroutine after_switch: called CC=5 SCAR=16.1
Pod documented
493 373 my ($seq) = @_;
494  
495 373 $seq->add_dagesh_if_needed;
496  
497 373 ▶ $seq->_on_geresh(\@VOWEL_AFTER_GERESH, sub { return; },);
Subroutine __ANON__: called CC=1 SCAR=0.0
498  
499 373 $seq->main_add( $seq->text_to_add );
500  
501 373 ▶ if ($seq->should_add_sheva)
Branch: 1 branch
BranchTrueFalseTotal
if ($seq->should_add_sheva) 15 358 373
502 {
503 15 $seq->_main_add_heb( 'SHEVA' );
504 }
505  
506 373 $seq->_on_geresh(\@VOWEL_BEFORE_GERESH, '_before_geresh_helper');
507  
508 373 ▶ if ($seq->at_end) {
Branch: 1 branch
BranchTrueFalseTotal
if ($seq->at_end) 95 278 373
509 95 ▶ if ($seq->_to_add_in([ $seq->list_heb(qw(QAMATS SEGOL))])) {
Branch: 1 branch
BranchTrueFalseTotal
if ($seq->_to_add_in([$seq->list_heb("QAMATS", "SEGOL")])) 35 60 95
510 35 $seq->_main_add_heb( 'HE' );
511 }
512 }
513  
514 373 ▶ if ($seq->_to_add_in($seq->all_hebrew_vowels)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($seq->_to_add_in($seq->all_hebrew_vowels)) 172 201 373
515 172 $seq->set_wrote_vowel;
516 }
517  
518 373 return;
519 }
520 }
521  
522 11 ▶sub before_switch {
Subroutine before_switch: called CC=3 SCAR=11.0
Pod documented
523 404 my ($seq) = @_;
524  
525 404 ▶ if ($seq->should_add_alef)
Branch: 1 branch
BranchTrueFalseTotal
if ($seq->should_add_alef) 33 371 404
526 {
527 33 $seq->_main_add_heb( 'ALEF' );
528 }
529  
530 404 ▶ if ($seq->try_geminated)
Branch: 1 branch
BranchTrueFalseTotal
if ($seq->try_geminated) 22 382 404
531 {
532 22 return $seq->next_letter_error_code;
533 }
534  
535 382 $seq->unset_wrote_vowel;
536  
537 382 return;
538 }
539  
540 95 ▶sub main_loop {
Subroutine main_loop: called CC=5 SCAR=16.1
Pod documented
541 95 my ($seq) = @_;
542
543 ITA_LETTER:
544 95 ▶ while (defined($seq->next_index)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $seq->next_index) 404 95 499
545 404 foreach my $method (qw(before_switch perform_switch after_switch)) {
546 1159 ▶ if (defined ( my $error_code = $seq->$method() ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $error_code = $seq->$method)) 31 1128 1159
547 31 ▶ if ($error_code eq $seq->next_letter_error_code()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($error_code eq $seq->next_letter_error_code) 31 0 31
548 31 next ITA_LETTER;
549 }
550 }
551 }
552 }
553  
554 95 return;
555 }
556  
557 102 ▶sub maqaf {
Subroutine maqaf: called CC=2 SCAR=6.9
Pod documented
558 102 my ($seq) = @_;
559  
560 102 ▶ return $seq->ascii_maqaf ? q{-} : $seq->heb('TRUE_MAQAF');
Branch: 1 branch
BranchTrueFalseTotal
$seq->ascii_maqaf ? : 1 101 102
561 }
562  
563 11 1; # End of Lingua::IT::Ita2heb::LettersSeq::IT::ToHeb
564  
565 __END__
« Ita2heb/LettersSeq/IT.pm ↑ Summary Ita2heb/LettersSeq.pm »