blib/lib/Lingua/Romana/Perligata.pm

filter: Statementstmt 56.5% 380 / 672 Branchbran 36.8% 171 / 464 Conditioncond 39.2% 71 / 181 MC/DCmcdc 9.1% 9 / 98 Subroutinesub 51.4% 35 / 68 Podpod 5.2% 1 / 19 totaltotal 44.4% 667 / 1502 SCAR 95.3
CC
302
Cov
47%
tokenize
4656.9
command
601.8
translate
304.8
CRAP 13705.3
↑ Summary
1 package Lingua::Romana::Perligata;
2  
3 2 our $VERSION = '0.602';
4  
5 2 ▶use Filter::Util::Call;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use IO::Handle;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Data::Dumper 'Dumper';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 my $offset = 0;
10 2 my $translate = 0;
11 2 my $debug = 0;
12  
13 sub import {
14 2 ▶ filter_add({});
Subroutine import: called CC=1 SCAR=0.0
15 2 $offset = (caller)[2]+1;
16 2 $translate = grep /^converte?$/i, @_[1..$#_];
17 2 $debug = grep /^investiga?$/i, @_[1..$#_];
18 2 $lex = grep /^discribe?$/i, @_[1..$#_];
19 2 1;
20 }
21  
22 2 $translator = q{
23 BEGIN {
24 $SIG{__DIE__} = sub { die Lingua::Romana::Perligata::readversum($_[0]) };
25 $SIG{__WARN__} = sub { return if $_[0] =~ /(...) interpreted as function/;
26 warn Lingua::Romana::Perligata::readversum($_[0]) };
27 }
28 };
29  
30 0 ▶sub unimport { filter_del() }
Subroutine unimport: not called CC=1 SCAR=6.9
31  
32 sub filter {
33 4 ▶ my($self) = @_ ;
Subroutine filter: called CC=7 SCAR=21.5
Pod undocumented
34  
35 4 my $status = 1;
36 4 $status = filter_read(100_000);
37 4 ▶ return $status if $status<0;
Branch: 1 branch
BranchTrueFalseTotal
if $status < 0 0 4 4
38 4 s/\A#!.*\n//;
39 4 $tokens = tokenize($_);
40  
41 4 my @commands;
42 4 ▶ push @commands, conn_command($tokens,'END') while @$tokens;
Branch: 1 branch
BranchTrueFalseTotal
@$tokens and do { push @commands, conn_command($tokens, "END") } 4 4 8
43 4 $_ = join ";\n", map { $_->translate } @commands;
44  
45 4 ▶ if ($translate) { print "$_;\n" and exit }
Branch: 3 branches
BranchTrueFalseTotal
if ($translate) { } 0 4 4
elsif ($debug and /\S/) { } 0 8 8
print "$_;\n" and exit 0 0 0
46 ▶ elsif ($debug && /\S/) {
Condition33%1/3
$debug and /\S/
!ll&&!rl&&r
400
MC/DC0%0/2
$debug and /\S/
$debug /\S/
Truth table33%1/3
A and B
A= $debugB= /\S/
ABresult
0X0
100
111
47 0 print "=" x 72,
48 "\nTranslated to:\n\n$_\n",
49 "=" x 72;
50 }
51 4 $_ = "$translator\n#line $offset\n;$_";
52 4 return $status;
53 }
54  
55 #==========TOKENIZER============
56  
57 0 ▶sub adversum { " ad versum " . to_rn($_[0]->{line}) . "\n" }
Subroutine adversum: not called CC=1 SCAR=6.9
Pod undocumented
58 0 ▶sub readversum { $_[0] =~ m{(.*)at\s+(\S+)\s+line\s+(\d+)(.*)}s or return $_[0];
Subroutine readversum: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0] =~ /(.*)at\s+(\S+)\s+line\s+(\d+)(.*)/s or return $_[0] 0 0 0
59 0 return $1 . " ad $2 versum " . to_rn($3) . $4 }
60  
61 sub make_range {
62 20 ▶ my ($unit, $five, $ten) = @_;
Subroutine make_range: called CC=1 SCAR=0.0
Pod undocumented
63 20 my ($two, $three) = ($unit x 2, $unit x 3);
64 20 return [ "", $unit, $two, $three, $unit.$five, $five,
65 $five.$unit, $five.$two, $five.$three, $unit.$ten ];
66 }
67  
68 2 my @order = (
69 make_range(qw{ I V X }),
70 make_range(qw{ X L C }),
71 make_range(qw{ C D M }),
72 make_range(qw{ M I)) ((I)) }),
73 make_range(qw{ ((I)) I))) (((I))) }),
74 make_range(qw{ (((I))) I)))) ((((I)))) }),
75 make_range(qw{ ((((I)))) I))))) (((((I))))) }),
76 make_range(qw{ (((((I))))) I)))))) ((((((I)))))) }),
77 make_range(qw{ ((((((I)))))) I))))))) (((((((I))))))) }),
78 make_range(qw{ (((((((I))))))) I)))))))) ((((((((I)))))))) }),
79 );
80  
81 2 my %val;
82 2 foreach my $power (0..$#order) {
83 20 @val{@{$order[$power]}} = map {$_*10**$power} 0..9;
84 }
85  
86 2 my $roman = '(' . join(")(", map {join("|",map { quotemeta } reverse(@$_))} reverse @order) . '|)';
87  
88 sub from_rn {
89 2 ▶ my $val = shift;
Subroutine from_rn: called CC=3 SCAR=11.0
Pod undocumented
90 2 @numerals = $val =~ /(?:$roman)/ix;
91 2 ▶ join("",@numerals) eq $val or return $val;
Branch: 1 branch
BranchTrueFalseTotal
join("", @numerals) eq $val or return $val 0 2 2
92 2 my $an = 0;
93 2 $an += $val{$_} foreach @numerals;
94 2 return $an;
95 }
96  
97 sub __beautify__ {
98 0 ▶ my ($text) = @_;
Subroutine __beautify__: not called CC=1 SCAR=6.9
99 0 $text =~ s/\b(\d+)\b/to_rn($1)/ge;
100 0 return $text;
101 }
102  
103 sub to_rn {
104 0 ▶ return "nullum" if $_[0] == 0;
Subroutine to_rn: not called CC=5 SCAR=34.0
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] == 0 0 0 0
105 0 @digits = split '', $_[0];
106 0 ▶ return $_[0] if grep {/\D/} @digits;
Branch: 1 branch
BranchTrueFalseTotal
if grep {/\D/;} @digits 0 0 0
107 0 my $power = 0;
108 0 my $rn = "";
109 0 ▶ $rn = $order[$power++][$_||0] . $rn foreach reverse @digits;
Condition0%0/2
$_ || 0
l!l
00
MC/DC0%0/1
$_ || 0
$_
Truth table0%0/2
A
A= $_
Aresult
11
00
110 0 return $rn;
111 }
112  
113 sub getline {
114 0 ▶ my ($fh) = @_;
Subroutine getline: not called CC=5 SCAR=34.0
Pod undocumented
115 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
116 0 my @lines = IO::Handle::getlines($fh);
117 0 ▶ s/\b($roman)\b/$1 ? from_rn($1) : $1/ge for @lines;
Branch: 1 branch
BranchTrueFalseTotal
$1 ? : 0 0 0
118 0 return @lines;
119 }
120 else {
121 0 my $line = IO::Handle::getline($fh);
122 0 ▶ $line =~ s/\b($roman)\b/$1 ? from_rn($1) : $1/ge;
Branch: 1 branch
BranchTrueFalseTotal
$1 ? : 0 0 0
123 0 return $line;
124 }
125 }
126  
127 sub multibless(\%$$)
128 {
129 66 ▶ my ($hash,$blesstype,$lextype) = @_;
Subroutine multibless: called CC=2 SCAR=6.9
Pod undocumented
130 66 foreach my $key (keys %$hash)
131 {
132 1514 $hash->{$key}{lex} = $lextype;
133 1514 bless $hash->{$key}, $blesstype;
134 }
135 }
136  
137 sub addres(\%$$)
138 {
139 16 ▶ my ($hash,$blesstype,$lextype) = @_;
Subroutine addres: called CC=2 SCAR=6.9
Pod undocumented
140 16 my (%acc, %dat);
141 16 foreach my $key (keys %$hash)
142 {
143 258 $acc{$key.'mentum'} = { %{$hash->{$key}} };
144 258 $acc{$key.'menta'} = { %{$hash->{$key}} };
145 258 $dat{$key.'mento'} = { %{$hash->{$key}} };
146 258 $dat{$key.'mentis'} = { %{$hash->{$key}} };
147 }
148 16 multibless %acc, $blesstype, $lextype.'_ACCUSATIVE';
149 16 multibless %dat, $blesstype, $lextype.'_DATIVE';
150 16 %$hash = ( %$hash, %acc, %dat );
151 }
152  
153 sub add_genitives(\%$$$)
154 {
155 10 ▶ my ($hash, $blesstype, $from, $to) = @_;
Subroutine add_genitives: called CC=3 SCAR=11.0
Pod undocumented
156 10 foreach my $key (keys %$hash)
157 {
158 354 my $genkey = $key;
159 354 ▶ $genkey =~ s/$from$/$to/ or next;
Branch: 1 branch
BranchTrueFalseTotal
$genkey =~ s/$from$/$to/ or next 278 76 354
160 76 $hash->{$genkey} = bless { %{$hash->{$key}},
161 lex => 'GENITIVE' },
162 $blesstype;
163 }
164 }
165  
166 2 my %literals =
167 (
168 'novumversum' => { perl => '"\n"' },
169 'biguttam' => { perl => '":"' },
170 'guttam' => { perl => '"."' },
171 'comma' => { perl => '","' },
172 'lacunam' => { perl => '" "' },
173 'stadium' => { perl => '"\t"' },
174 'parprimum' => { perl => '$1' },
175 'pardecimum' => { perl => '$10' },
176 'parsecundum' => { perl => '$2' },
177 'partertium' => { perl => '$3' },
178 'parquartum' => { perl => '$4' },
179 'parquintum' => { perl => '$5' },
180 'parsextum' => { perl => '$6' },
181 'parseptimum' => { perl => '$7' },
182 'paroctavum' => { perl => '$8' },
183 'parnonum' => { perl => '$9' },
184 'nomen' => { perl => '$<' },
185 );
186  
187 2 multibless %literals, 'Literal', 'ACCUSATIVE';
188 2 add_genitives %literals, 'Literal', 'um' => 'i';
189 2 add_genitives %literals, 'Literal', 'am' => 'ae';
190 2 add_genitives %literals, 'Literal', 'ma' => 'matis';
191  
192  
193 2 my %numerals =
194 (
195 'nullum' => { perl => '0' },
196 'unum' => { perl => '1' },
197 'unam' => { perl => '1' },
198 'duo' => { perl => '2' },
199 'duas' => { perl => '2' },
200 'tres' => { perl => '3' },
201 'quattuor' => { perl => '4' },
202 'quinque' => { perl => '5' },
203 'sex' => { perl => '6' },
204 'septem' => { perl => '7' },
205 'octo' => { perl => '8' },
206 'novem' => { perl => '9' },
207 'decem' => { perl => '10' },
208 );
209  
210 2 multibless %numerals, 'Literal', 'NUMERAL';
211  
212  
213 2 my %ordinals_a =
214 (
215 'nullimum' => { perl => '0' },
216 'primum' => { perl => '1' },
217 'secundum' => { perl => '2' },
218 'tertium' => { perl => '3' },
219 'quartum' => { perl => '4' },
220 'quintum' => { perl => '5' },
221 'sextum' => { perl => '6' },
222 'septimum' => { perl => '7' },
223 'octavum' => { perl => '8' },
224 'nonum' => { perl => '9' },
225 'decimum' => { perl => '10' },
226 );
227  
228 2 foreach ( map substr($_,0,-2), keys %ordinals_a ) {
229 22 $ordinals_a{"${_}os"} = $ordinals_a{"${_}um"}; # MASC. PLURALS
230 22 $ordinals_a{"${_}am"} = $ordinals_a{"${_}um"}; # FEMININE
231 22 $ordinals_a{"${_}as"} = $ordinals_a{"${_}um"}; # FEM. PLURALS
232 }
233  
234 2 multibless %ordinals_a, 'Ordinal', 'ORDINAL';
235 2 add_genitives %ordinals_a, 'Ordinal', 'um' => 'i';
236 2 add_genitives %ordinals_a, 'Ordinal', 'am' => 'ae';
237 # add_genitives %ordinals_a, 'Ordinal', 'os' => 'orum';
238  
239 2 my %ordinals_d =
240 (
241 'nullimo' => { perl => '0' },
242 'primo' => { perl => '1' },
243 'secundo' => { perl => '2' },
244 'tertio' => { perl => '3' },
245 'quarto' => { perl => '4' },
246 'quinto' => { perl => '5' },
247 'sexto' => { perl => '6' },
248 'septimo' => { perl => '7' },
249 'octavo' => { perl => '8' },
250 'nono' => { perl => '9' },
251 'decimo' => { perl => '10' },
252 );
253  
254 2 multibless %ordinals_d, 'Ordinal', 'ORDINAL_DATIVE';
255  
256 2 my %underscores =
257 (
258 'hoc' => { perl => '$_', lex => 'ACCUSATIVE'},
259 'huius' => { perl => '$_', lex => 'GENITIVE'},
260 'huic' => { perl => '$_', lex => 'DATIVE'},
261 'haec' => { perl => '@_', lex => 'ACCUSATIVE'},
262 'horum' => { perl => '@_', lex => 'GENITIVE'},
263 'his' => { perl => '@_', lex => 'DATIVE'},
264 'ianitorem' => { perl => '$/', lex => 'ACCUSATIVE' },
265 'ianitoris' => { perl => '$/', lex => 'GENITIVE' },
266 'ianitori' => { perl => '$/', lex => 'DATIVE' },
267 );
268  
269 2 for my $key ( keys %underscores )
270 {
271 18 bless $underscores{$key}, 'Literal';
272 }
273  
274 2 my %varmods =
275 (
276 'loco' => bless ({ perl => 'local', lex => 'OWNER_D' },
277 'ScalarMod'),
278 'locis' => bless ({ perl => 'local', lex => 'OWNER_D' },
279 'ArrMod'),
280 'meo' => bless ({ perl => 'my', lex => 'OWNER_D' },
281 'ScalarMod'),
282 'meis' => bless ({ perl => 'my', lex => 'OWNER_D' },
283 'ArrMod'),
284 'nostro' => bless ({ perl => 'our', lex => 'OWNER_D' },
285 'ScalarMod'),
286 'nostris' => bless ({ perl => 'our', lex => 'OWNER_D' },
287 'ArrMod'),
288 );
289  
290 2 my %streams =
291 (
292 'vestibulo' => { perl => '*STDIN' },
293 'egresso' => { perl => 'STDOUT' },
294 'oraculo' => { perl => 'STDERR' },
295 'nuntio' => { perl => '*Lingua::Romana::Perligata::DATA' },
296 );
297 2 multibless %streams, 'Literal', 'DATIVE';
298  
299 2 my %matchops =
300 (
301 'compara' => { perl => 'm' },
302 'substitue' => { perl => 's' },
303 'converte' => { perl => 'tr' },
304 );
305  
306 2 multibless %matchops, 'MatchOperator', 'SUBNAME';
307 2 addres %matchops, 'MatchOperator', 'SUBNAME';
308  
309 2 my %ops =
310 (
311 'adde' => { perl => '+' },
312 'deme' => { perl => '-' },
313 'multiplica' => { perl => '*' },
314 'itera' => { perl => 'x' },
315 'divide' => { perl => '/' },
316 'recide' => { perl => '%' },
317 'eleva' => { perl => '**' },
318 'consocia' => { perl => '&' },
319 'interseca' => { perl => '|' },
320 'discerne' => { perl => '^' },
321 'depone' => { perl => '' , prefix => 1 },
322 );
323  
324 2 $ops{$_}{operator} = 1 foreach keys %ops;
325 2 multibless %ops, 'Operator', 'SUBNAME_A';
326 2 addres %ops, 'Operator', 'SUBNAME_A';
327  
328 2 my %lops =
329 (
330 'da' => { perl => '=', operator => 1 },
331 );
332  
333 2 multibless %lops, 'Operator', 'SUBNAME_AD';
334 2 addres %lops, 'Operator', 'SUBNAME_AD';
335  
336 2 my %invarops =
337 (
338 'atque' => { perl => '&&' },
339 'vel' => { perl => '||' },
340 'praestantiam' => { perl => '<' },
341 'non praestantiam' => { perl => '>=' },
342 'praestantias' => { perl => 'lt' },
343 'non praestantias' => { perl => 'ge' },
344 'aequalitam' => { perl => '==' },
345 'non aequalitam' => { perl => '!=' },
346 'aequalitas' => { perl => 'eq' },
347 'non aequalitas' => { perl => 'ne' },
348 'comparitiam' => { perl => '<=>' },
349 'comparitias' => { perl => 'cmp' },
350 'non comparitiam' => { perl => '!<=>' },
351 'non comparitias' => { perl => '!cmp' },
352  
353 'non' => { perl => '!', prefix => 1 },
354 'nega' => { perl => '-', prefix => 1 },
355 );
356  
357 2 $invarops{$_}{operator} = 1 foreach keys %invarops;
358 2 multibless %invarops, 'Operator', 'SUBNAME_A_ACCUSATIVE';
359  
360 2 my %connectives =
361 (
362 'que' => { perl => 'and' },
363 've' => { perl => 'or' },
364 );
365  
366 2 @{$connectives{$_}}{'operator','raw'} = (1,-$_) foreach keys %connectives;
367 2 multibless %connectives, 'Operator', 'CONNECTIVE';
368  
369 2 my %funcs_td =
370 (
371 'excerpe' => { perl => 'substr' }, # SPECIAL: SEE BELOW
372  
373 'cumula' => { perl => 'push' },
374 'capita' => { perl => 'unshift' },
375 'iunge' => { perl => 'splice' },
376 'digere' => { perl => 'sort' },
377 'retexe' => { perl => 'reverse' },
378 'evolute' => { perl => 'open' },
379 'lege' => { perl => 'read' },
380 'scribe' => { perl => 'print' },
381 'describe' => { perl => 'printf' },
382 'subscribe' => { perl => 'write' },
383 'conquire' => { perl => 'seek' },
384 'benedice' => { perl => 'bless' },
385 'liga' => { perl => 'tie' },
386 'modera' => { perl => 'fcntl' },
387 'conflue' => { perl => 'flock' },
388 'impera' => { perl => 'ioctl' },
389 'trunca' => { perl => 'truncate' },
390 );
391  
392 2 multibless %funcs_td, 'Function', 'SUBNAME_AD';
393 2 addres %funcs_td, 'Function', 'SUBNAME_AD';
394  
395 # "bless" HAS A COMMON LATIN CONTRACTION...
396  
397 2 $funcs_td{benedictum} = $funcs_td{benedicementum};
398 2 $funcs_td{benedicto} = $funcs_td{benedicemento};
399  
400 # THE FOLLOWING IS LVALUABLE, SO ARG MUST AGREE IN CASE WITH FUNCTION'S CASE...
401  
402 2 for (qw( excerpe )) {
403 2 $funcs_td{"${_}mentum"}{lex} = 'SUBNAME_A_ACCUSATIVE';
404 }
405  
406  
407 2 my %funcs_bd =
408 (
409 'vanne' => { perl => 'grep' },
410 'applica' => { perl => 'map' },
411 'digere' => { perl => 'sort' },
412 );
413  
414 2 multibless %funcs_bd, 'Function', 'SUBNAME_AB';
415 2 addres %funcs_bd, 'Function', 'SUBNAME_AB';
416  
417 2 my %funcs_b =
418 (
419 'factorem' => { perl => 'sub' },
420 'factori' => { perl => 'sub' },
421 );
422  
423 2 multibless %funcs_b, 'Function', 'SUBNAME_B_ACCUSATIVE';
424 2 $funcs_b{'factori'}{lex} = 'SUBNAME_B_DATIVE';
425  
426  
427 2 my %funcs_t =
428 (
429 'morde' => { perl => 'chomp' },
430 'praecide' => { perl => 'chop' },
431 'stude' => { perl => 'study' },
432 'iani' => { perl => 'undef' },
433 'lusta' => { perl => 'reset' },
434 'decumula' => { perl => 'pop' },
435 'decapita' => { perl => 'shift' },
436 'claude' => { perl => 'close' },
437 'perlege' => { perl => 'Lingua::Romana::Perligata::getline' },
438 'sublege' => { perl => 'getc' },
439 'enunta' => { perl => 'tell' },
440 'dele' => { perl => 'delete' },
441 'quisque' => { perl => 'each' },
442 'adfirma' => { perl => 'exists' },
443 'solvere' => { perl => 'untie' },
444 'preincresce' => { perl => '++', prefix => 1, operator => 1 },
445 'postincresce' => { perl => '++', prefix => 0, operator => 1 },
446 'predecresce' => { perl => '--', prefix => 1, operator => 1 },
447 'postdecresce' => { perl => '--', prefix => 0, operator => 1 },
448  
449 'reperi' => { perl => 'pos' }, # SPECIAL: SEE BELOW
450 'nomina' => { perl => 'keys' }, # SPECIAL: SEE BELOW
451 );
452  
453 2 multibless %funcs_t, 'Function', 'SUBNAME_D';
454 2 addres %funcs_t, 'Function', 'SUBNAME_D';
455  
456  
457 # THE FOLLOWING ARE LVALUABLE, SO ARG MUST AGREE IN CASE WITH FUNCTION'S CASE...
458  
459 2 for (qw( reperi nomina )) {
460 4 $funcs_t{"${_}mentum"}{lex} = 'SUBNAME_A_ACCUSATIVE';
461 }
462  
463 2 my %funcs_d =
464 (
465 'admeta' => { perl => 'Lingua::Romana::Perligata::__lastelem__' },
466 'inque' => { perl => 'Lingua::Romana::Perligata::__enquote__' },
467 'conscribe' => { perl => 'Lingua::Romana::Perligata::__enlist__' },
468 'come' => { perl => 'Lingua::Romana::Perligata::__beautify__' },
469 'priva' => { perl => 'abs' },
470 'angula' => { perl => 'atan2' },
471 'oppone' => { perl => 'sin' },
472 'accuba' => { perl => 'cos' },
473 'decolla' => { perl => 'int' },
474 'succide' => { perl => 'log' },
475 'fode' => { perl => 'sqrt' },
476 'conice' => { perl => 'rand' },
477 'prosemina' => { perl => 'srand' },
478 'inde' => { perl => 'chr' },
479 'senidemi' => { perl => 'hex' },
480 'octoni' => { perl => 'oct' },
481 'numera' => { perl => 'ord' },
482 'deminue' => { perl => 'lc' },
483 'minue' => { perl => 'lcfirst' },
484 'amplifica' => { perl => 'uc' },
485 'amplia' => { perl => 'ucfirst' },
486 'excipe' => { perl => 'quotemeta' },
487 'huma' => { perl => 'crypt' },
488 'meta' => { perl => 'length' },
489 'convasa' => { perl => 'pack' },
490 'deconvasa' => { perl => 'unpack' },
491 'scinde' => { perl => 'split' },
492 'scruta' => { perl => 'index' },
493 'coniunge' => { perl => 'join' },
494 'confirma' => { perl => 'defined' },
495 'secerna' => { perl => 'scalar' },
496 'argue' => { perl => 'values' },
497 'extremus' => { perl => 'eof' },
498 'deside' => { perl => 'wantarray' },
499 'aestima' => { perl => 'eval' },
500 'exi' => { perl => 'exit' },
501 'redde' => { perl => 'return' },
502 'mori' => { perl => 'die' },
503 'mone' => { perl => 'warn' },
504 'coaxa' => { perl => 'Carp::croak' },
505 'carpe' => { perl => 'Carp::carp' },
506 'memora' => { perl => 'caller' },
507 'agnosce' => { perl => 'ref' },
508 'exhibere' => { perl => 'tied' },
509 'require' => { perl => 'require' },
510 'demigrare' => { perl => 'chdir' },
511 'permitte' => { perl => 'chmod' },
512 'vende' => { perl => 'chown' },
513 'inveni' => { perl => 'glob' },
514 'copula' => { perl => 'link' },
515 'decopula' => { perl => 'unlink' },
516 'aedifica' => { perl => 'mkdir' },
517 'renomina' => { perl => 'rename' },
518 'excide' => { perl => 'rmdir' },
519 'exprime' => { perl => 'stat' },
520 'terre' => { perl => 'alarm' },
521 'mitte' => { perl => 'dump' },
522 'commuta' => { perl => 'exec' },
523 'furca' => { perl => 'fork' },
524 'interfice' => { perl => 'kill' },
525 'dormi' => { perl => 'sleep' },
526 'obsecra' => { perl => 'system' },
527 'dissimula' => { perl => 'umask' },
528 'manta' => { perl => 'wait' },
529  
530 'inscribe' => { perl => ':' }, # SPECIAL: SEE BELOW
531 'arcesse' => { perl => '${' }, # SPECIAL: SEE BELOW
532  
533 'sere' => { perl => 'Lingua::Romana::Perligata::__encatenate__' },
534 );
535  
536 2 multibless %funcs_d, 'Function', 'SUBNAME_A';
537 2 addres %funcs_d, 'Function', 'SUBNAME_A';
538  
539 # 'inscribe' IS SPECIAL: ONLY IMPERATIVE
540  
541 2 delete @funcs_d{grep /^inscribement/, keys %funcs_d};
542  
543 # 'arcesse' IS SPECIAL: NO IMPERATIVE AND EXTRA (PSEUDO-)RESULTATIVES
544  
545 2 delete $funcs_d{'arcesse'};
546  
547 # SCALAR AS NON-TERMINAL INDEX
548  
549 2 $funcs_d{'arcessementi'} = { %{$funcs_d{'arcessementum'}},
550 lex => 'SUBNAME_A_GENITIVE' };
551  
552 # ARRAY DEREFERENCE
553  
554 2 $funcs_d{'arcessementa'}{perl} = '@{';
555 2 $funcs_d{'arcessementis'}{perl} = '@{';
556 2 $funcs_d{'arcessementorum'} = { %{$funcs_d{'arcessementa'}},
557 lex => 'SUBNAME_A_GENITIVE' };
558  
559 2 $funcs_d{'arcessementus'} = { %{$funcs_d{'arcessementa'}}, perl => '%{' };
560 2 $funcs_d{'arcessementibus'} = { %{$funcs_d{'arcessementis'}}, perl => '%{' };
561 2 $funcs_d{'arcessementuum'} = { %{$funcs_d{'arcessementus'}},
562 lex => 'SUBNAME_A_GENITIVE'};
563  
564  
565 2 my %funcs_dl =
566 (
567 'adi' => { perl => 'goto' },
568 'confectus' => { perl => 'continue' },
569 'domus' => { perl => 'package' },
570 'legatarius' => { perl => 'use base' },
571 'ute' => { perl => 'use' },
572 );
573  
574 2 multibless %funcs_dl, 'Function_Lit', 'SUBNAME_A';
575 2 addres %funcs_dl, 'Function_Lit', 'SUBNAME_A';
576  
577 2 my %funcs_dlo =
578 (
579 'ultimus' => { perl => 'last' },
580 'posterus' => { perl => 'next' },
581 'reconnatus' => { perl => 'redo' },
582 );
583  
584 2 multibless %funcs_dlo, 'Function_Lit', 'SUBNAME_OA';
585 # addres %funcs_dl, 'Function_Lit', 'SUBNAME_OA';
586  
587 2 my %misc =
588 (
589 'fac' => { lex => 'DO', perl => 'do' },
590 'per' => { lex => 'FOR', perl => 'for' },
591 'per quisque' => { lex => 'FOR', perl => 'foreach' },
592 'si' => { lex => 'CONTROL', perl => 'if' },
593 'nisi' => { lex => 'CONTROL', perl => 'unless' },
594 'donec' => { lex => 'CONTROL', perl => 'until' },
595 'dum' => { lex => 'CONTROL', perl => 'while' },
596 'cum' => { lex => 'WITH', perl => '' },
597 'intra' => { lex => 'WITHIN', perl => '::' },
598 'apud' => { lex => 'ARROW', perl => '->' },
599 'tum' => { lex => 'COMMA', perl => ',' },
600 'in' => { lex => 'IN', perl => '' },
601 'sic' => { lex => 'BEGIN', perl => '{' },
602 'cis' => { lex => 'END', perl => '}' },
603 'princeps' => { lex => 'NAME', raw=>'main',perl => 'main' },
604 'ad' => { lex => 'ADDRESS', perl => '\\' },
605 );
606  
607 2 my %tokens =
608 (
609 %literals, %numerals, %underscores,
610 %numerals, %ordinals_a, %ordinals_d,
611 %varmods, %matchops, %ops, %lops, %invarops,
612 %funcs_td, %funcs_bd, %funcs_b, %funcs_t,
613 %funcs_d, %funcs_dl, %funcs_dlo,
614 %misc, %streams,
615 );
616  
617 # Handle likely captialization variations...
618 2 @tokens{map {ucfirst} keys %tokens} = values %tokens;
619  
620 2 foreach my $key ( keys %tokens )
621 {
622 $tokens{$key}{raw} = $key
623 3284 ▶ unless $tokens{$key}{raw};
Branch: 1 branch
BranchTrueFalseTotal
unless $tokens{$key}{"raw"} 1570 1714 3284
624 }
625  
626 2 my $distokens = join '|', reverse sort keys %tokens;
627 2 my $tokens = "\\A\\s*($distokens)\\b";
628 2 my $tokensque = "\\A\\s*($distokens)que\\b";
629 2 my $tokensve = "\\A\\s*($distokens)ve\\b";
630  
631 sub token($$$$)
632 {
633 16 ▶ my ($raw, $lex, $perl, $blesstype) = @_;
Subroutine token: called CC=1 SCAR=0.0
Pod undocumented
634 16 return bless { raw => $raw, lex => $lex, perl => $perl }, $blesstype;
635 }
636  
637 sub tokdup
638 {
639 38 ▶ my ($archetype) = @_;
Subroutine tokdup: called CC=1 SCAR=0.0
Pod undocumented
640 38 bless { %$archetype }, $archetype->{lex};
641 }
642  
643 sub tokenize
644 {
645 4 ▶ my ($text) = @_;
Subroutine tokenize: called CC=107 SCAR=84.5
Pod undocumented
646 4 my @tokens;
647 4 my $bad = "";
648 4 my $lines = $text =~ tr/\n/\n/;
649  
650 4 ▶ while (length $text)
Branch: 1 branch
BranchTrueFalseTotal
if (length $text) 56 4 60
651 {
652 56 $text =~ s/\A\s+//;
653 56 my $line = $lines - ($text =~ tr/\n/\n/) + $offset;
654 56 ▶ if ($text =~ s/\A(adnota.*)//i)
Branch: 30 branches
BranchTrueFalseTotal
if ($text =~ s/\A(adnota.*)//i) { } 0 56 56
elsif ($text =~ s/\A(nuntius|finis)[ \t]*[.]?[ \t]*\n(.*)//ism) { } 0 56 56
elsif ($text =~ s/\Adic(?:emen)?tum(que|ve|)\s+sic\s+\b(.*?)\s+cis\b//is) { } 0 56 56
elsif ($text =~ s/\Asic(que|ve|)\s+(.*?)\s+cis\s+dic(?:emen)?tum\b//is) { } 0 56 56
elsif ($text =~ s/\A(atque|vel)\b//i) { } 0 56 56
elsif ($text =~ s/\A(($roman)im(?:o|ae)(que|ve|))\b//xi and length $2) { } 0 56 56
elsif ($text =~ s/\A(($roman)im(?:um|os|am|as)(que|ve|))\b//xi and length $2) { } 0 56 56
elsif ($text =~ s/\A(($roman)(que|ve|))\b//xi and length $2) { } 2 54 56
elsif ($text =~ s/$tokensque//i) { } 0 54 54
elsif ($text =~ s/$tokensve//i) { } 0 54 54
elsif ($text =~ s/$tokens//i) { } 38 16 54
elsif ($text =~ s/\A(([a-z_][0-9a-z_]*?)(um|)ementum)(que|ve|)((?:\s+)sicut)?\b//i) { } 0 16 16
elsif ($text =~ s/\A(([a-z_][0-9a-z_]*?)(um|)ementa)(que|ve|)((?:\s+)sicut)?\b//i) { } 0 16 16
elsif ($text =~ s/\A(([a-z_][0-9a-z_]*?)(um|)emento)(que|ve|)((?:\s+)sicut)?\b//i) { } 0 16 16
elsif ($text =~ s/\A(([a-z_][0-9a-z_]*?)(um|)ementis)(que|ve|)((?:\s+)sicut)?\b//i) { } 0 16 16
elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)orum)(que|ve|)((?:\s+)sicut)?\b//i) { } 0 16 16
elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)uum)(que|ve|)((?:\s+)sicut)?\b//i) { } 0 16 16
elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)um)(que|ve|)((?:\s+)sicut)?\b//i) { } 4 12 16
elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)a)(que|ve|)((?:\s+)sicut)?\b//i) { } 0 12 12
elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)ibus)(que|ve|)((?:\s+)sicut)?\b//i) { } 0 12 12
elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)us)(que|ve|)((?:\s+)sicut)?\b//i) { } 0 12 12
elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)o)(que|ve|)((?:\s+)sicut)?\b//i) { } 0 12 12
elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)is)(que|ve|)((?:\s+)sicut)?\b//i) { } 0 12 12
elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)tori)(que|ve|)((?:\s+)sicut)?\b//i) { } 0 12 12
elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)i)(que|ve|)((?:\s+)sicut)?\b//i) { } 0 12 12
elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)ere)(que|ve|)((?:\s+)sicut)?\b//i) { } 2 10 12
elsif ($text =~ s/\A(([a-z_][0-9a-z_]*?)(um|)e)(que|ve|)((?:\s+)sicut)?\b//i) { } 2 8 10
elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)torem)(que|ve|)((?:\s+)sicut)?\b//i) { } 0 8 8
elsif ($text =~ s/\A([.])//) { } 4 4 8
elsif ($text =~ s/\A(\S+)(que|ve|)((?:\s+)sicut)?\b//) { } 2 2 4
655 {
656 # ignore comments
657 }
658 elsif ($text =~ s/\A(nuntius|finis)[ \t]*[.]?[ \t]*\n(.*)//smi)
659 {
660 # set up DATA stream
661 2 ▶ use vars '*DATA';
Subroutine BEGIN: called CC=1 SCAR=0.0
662 0 local *Lingua::Romana::Perlidata::DATASRC;
663 0 my $pipe = pipe \*Lingua::Romana::Perligata::DATA,
664 \*Lingua::Romana::Perlidata::DATASRC;
665  
666 0 print Lingua::Romana::Perlidata::DATASRC $2;
667 }
668 elsif ($text =~ s/\Adic(?:emen)?tum(que|ve|)\s+sic\s+\b(.*?)\s+cis\b//si)
669 {
670 0 ▶ push @tokens, tokdup $connectives{lc $1} if $1;
Branch: 1 branch
BranchTrueFalseTotal
if $1 0 0 0
671 0 push @tokens, token($2,'NAME',"$2",'Name');
672 }
673 elsif ($text =~ s/\Asic(que|ve|)\s+(.*?)\s+cis\s+dic(?:emen)?tum\b//si)
674 {
675 0 ▶ push @tokens, tokdup $connectives{lc $1} if $1;
Branch: 1 branch
BranchTrueFalseTotal
if $1 0 0 0
676 0 push @tokens, token($2,'NAME',"$2",'Name');
677 }
678 elsif ($text =~ s/\A(atque|vel)\b//i)
679 {
680 0 push @tokens, tokdup $misc{'tum'};
681 0 push @tokens, tokdup $invarops{lc $1};
682 }
683 ▶ elsif ($text =~ s/\A(($roman)im(?:o|ae)(que|ve|))\b//ix && length $2)
Condition33%1/3
$text =~ s/\A(($roman)im(?:o|ae)(que|ve|))\b//xi and length $2
!ll&&!rl&&r
5600
MC/DC0%0/2
$text =~ s/\A(($roman)im(?:o|ae)(que|ve|))\b//xi and length $2
$text =~ s/\A(($roman)im(?:o|ae)(que|ve|))\b//xi length $2
Truth table33%1/3
A and B
A= $text =~ s/\A(($roman)im(?:o|ae)(que|ve|))\b//xiB= length $2
ABresult
0X0
100
111
684 {
685 0 ▶ push @tokens, tokdup $connectives{lc $+} if $+;
Branch: 1 branch
BranchTrueFalseTotal
if $+ 0 0 0
686 0 push @tokens, token($1,'ORDINAL_DATIVE',from_rn($2),'ORDINAL_DATIVE');
687 }
688 ▶ elsif ($text =~ s/\A(($roman)im(?:um|os|am|as)(que|ve|))\b//ix && length $2)
Condition33%1/3
$text =~ s/\A(($roman)im(?:um|os|am|as)(que|ve|))\b//xi and length $2
!ll&&!rl&&r
5600
MC/DC0%0/2
$text =~ s/\A(($roman)im(?:um|os|am|as)(que|ve|))\b//xi and length $2
$text =~ s/\A(($roman)im(?:um|os|am|as)(que|ve|))\b//xi length $2
Truth table33%1/3
A and B
A= $text =~ s/\A(($roman)im(?:um|os|am|as)(que|ve|))\b//xiB= length $2
ABresult
0X0
100
111
689 {
690 0 ▶ push @tokens, tokdup $connectives{lc $+} if $+;
Branch: 1 branch
BranchTrueFalseTotal
if $+ 0 0 0
691 0 push @tokens, token($1,'ORDINAL',from_rn($2),'ORDINAL');
692 }
693 ▶ elsif ($text =~ s/\A(($roman)(que|ve|))\b//ix && length $2)
Condition100%3/3
$text =~ s/\A(($roman)(que|ve|))\b//xi and length $2
!ll&&!rl&&r
6482
MC/DC100%2/2
$text =~ s/\A(($roman)(que|ve|))\b//xi and length $2
$text =~ s/\A(($roman)(que|ve|))\b//xi length $2
Truth table100%3/3
A and B
A= $text =~ s/\A(($roman)(que|ve|))\b//xiB= length $2
ABresult
0X0
100
111
694 {
695 2 ▶ push @tokens, tokdup $connectives{lc $+} if $+;
Branch: 1 branch
BranchTrueFalseTotal
if $+ 0 2 2
696 2 push @tokens, token($1,'NUMERAL',from_rn($2),'NUMERAL');;
697 }
698 elsif ($text =~ s/$tokensque//i)
699 {
700 0 push @tokens, tokdup $connectives{'que'};
701 0 push @tokens, tokdup $tokens{lc $1};
702 }
703 elsif ($text =~ s/$tokensve//i)
704 {
705 0 push @tokens, tokdup $connectives{'ve'};
706 0 push @tokens, tokdup $tokens{lc $1};
707 }
708 elsif ($text =~ s/$tokens//i)
709 {
710 38 push @tokens, tokdup $tokens{lc $1};
711 }
712 elsif ($text =~ s/\A(([a-z_][0-9a-z_]*?)(um|)ementum)(que|ve|)((?:\s+)sicut)?\b//i)
713 {
714 0 ▶ if ($5)
Branch: 1 branch
BranchTrueFalseTotal
if ($5) { } 0 0 0
715 {
716 0 ▶ my $token = $4 ? $1.$4 : $1;
Branch: 1 branch
BranchTrueFalseTotal
$4 ? : 0 0 0
717 0 push @tokens, token($token,'NAME',$token,'Name');
718 }
719 else
720 {
721 0 ▶ push @tokens, tokdup $connectives{lc $4} if $4;
Branch: 1 branch
BranchTrueFalseTotal
if $4 0 0 0
722 0 ▶ my $perl = $3 ? "\$$2->" : $2;
Branch: 1 branch
BranchTrueFalseTotal
$3 ? : 0 0 0
723 0 push @tokens, token($1,'SUBNAME_OA_ACCUSATIVE',$perl,'Literal');
724 }
725 }
726 elsif ($text =~ s/\A(([a-z_][0-9a-z_]*?)(um|)ementa)(que|ve|)((?:\s+)sicut)?\b//i)
727 {
728 0 ▶ if ($5)
Branch: 1 branch
BranchTrueFalseTotal
if ($5) { } 0 0 0
729 {
730 0 ▶ my $token = $4 ? $1.$4 : $1;
Branch: 1 branch
BranchTrueFalseTotal
$4 ? : 0 0 0
731 0 push @tokens, token($token,'NAME',$token,'Name');
732 }
733 else
734 {
735 0 ▶ push @tokens, tokdup $connectives{lc $4} if $4;
Branch: 1 branch
BranchTrueFalseTotal
if $4 0 0 0
736 0 ▶ my $perl = $3 ? "\$$2->" : $2;
Branch: 1 branch
BranchTrueFalseTotal
$3 ? : 0 0 0
737 0 push @tokens, token($1,'SUBNAME_OA_ACCUSATIVE',$perl,'Literal');
738 }
739 }
740 elsif ($text =~ s/\A(([a-z_][0-9a-z_]*?)(um|)emento)(que|ve|)((?:\s+)sicut)?\b//i)
741 {
742 0 ▶ if ($5)
Branch: 1 branch
BranchTrueFalseTotal
if ($5) { } 0 0 0
743 {
744 0 ▶ my $token = $4 ? $1.$4 : $1;
Branch: 1 branch
BranchTrueFalseTotal
$4 ? : 0 0 0
745 0 push @tokens, token($token,'NAME',$token,'Name');
746 }
747 else
748 {
749 0 ▶ push @tokens, tokdup $connectives{lc $4} if $4;
Branch: 1 branch
BranchTrueFalseTotal
if $4 0 0 0
750 0 ▶ my $perl = $3 ? "\$$2->" : $2;
Branch: 1 branch
BranchTrueFalseTotal
$3 ? : 0 0 0
751 0 push @tokens, token($1,'SUBNAME_OA_DATIVE',$perl,'Literal');
752 }
753 }
754 elsif ($text =~ s/\A(([a-z_][0-9a-z_]*?)(um|)ementis)(que|ve|)((?:\s+)sicut)?\b//i)
755 {
756 0 ▶ if ($5)
Branch: 1 branch
BranchTrueFalseTotal
if ($5) { } 0 0 0
757 {
758 0 ▶ my $token = $4 ? $1.$4 : $1;
Branch: 1 branch
BranchTrueFalseTotal
$4 ? : 0 0 0
759 0 push @tokens, token($token,'NAME',"$perl",'Name');
760 }
761 else
762 {
763 0 $bad .= "'-mentis' illicitum: '$1'"
764 . adversum({line=>$line});
765 # One day this may be:
766 #
767 # push @tokens, tokdup $connectives{lc $4} if $4;
768 # my $perl = $3 ? "\$$2->" : $2;
769 # push @tokens, token($1,'SUBNAME_OA_DATIVE',$perl,'Literal');
770 }
771 }
772 elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)orum)(que|ve|)((?:\s+)sicut)?\b//i)
773 {
774 0 ▶ if ($4)
Branch: 1 branch
BranchTrueFalseTotal
if ($4) { } 0 0 0
775 {
776 0 ▶ my $token = $3 ? $1.$3 : $1;
Branch: 1 branch
BranchTrueFalseTotal
$3 ? : 0 0 0
777 0 push @tokens, token($token,'NAME',$token,'Name');
778 }
779 else
780 {
781 0 ▶ push @tokens, tokdup $connectives{lc $3} if $3;
Branch: 1 branch
BranchTrueFalseTotal
if $3 0 0 0
782 0 push @tokens, token($1,'GENITIVE',"\@$2",'Literal');
783 }
784 }
785 elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)uum)(que|ve|)((?:\s+)sicut)?\b//i)
786 {
787 0 ▶ if ($4)
Branch: 1 branch
BranchTrueFalseTotal
if ($4) { } 0 0 0
788 {
789 0 ▶ my $token = $3 ? $1.$3 : $1;
Branch: 1 branch
BranchTrueFalseTotal
$3 ? : 0 0 0
790 0 push @tokens, token($token,'NAME',$token,'Name');
791 }
792 else
793 {
794 0 ▶ push @tokens, tokdup $connectives{lc $3} if $3;
Branch: 1 branch
BranchTrueFalseTotal
if $3 0 0 0
795 0 push @tokens, token($1,'GENITIVE',"\%$2",'Literal');
796 }
797 }
798 elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)um)(que|ve|)((?:\s+)sicut)?\b//i)
799 {
800 4 ▶ if ($4)
Branch: 1 branch
BranchTrueFalseTotal
if ($4) { } 0 4 4
801 {
802 0 ▶ my $token = $3 ? $1.$3 : $1;
Branch: 1 branch
BranchTrueFalseTotal
$3 ? : 0 0 0
803 0 push @tokens, token($token,'NAME',$token,'Name');
804 }
805 else
806 {
807 4 ▶ push @tokens, tokdup $connectives{lc $3} if $3;
Branch: 1 branch
BranchTrueFalseTotal
if $3 0 4 4
808 4 push @tokens, token($1,'ACCUSATIVE',"\$$2",'Literal');
809 }
810 }
811 elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)a)(que|ve|)((?:\s+)sicut)?\b//i)
812 {
813 0 ▶ if ($4)
Branch: 1 branch
BranchTrueFalseTotal
if ($4) { } 0 0 0
814 {
815 0 ▶ my $token = $3 ? $1.$3 : $1;
Branch: 1 branch
BranchTrueFalseTotal
$3 ? : 0 0 0
816 0 push @tokens, token($token,'NAME',$token,'Name');
817 }
818 else
819 {
820 0 ▶ push @tokens, tokdup $connectives{lc $3} if $3;
Branch: 1 branch
BranchTrueFalseTotal
if $3 0 0 0
821 0 push @tokens, token($1,'ACCUSATIVE',"\@$2",'Literal');
822 }
823 }
824 elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)ibus)(que|ve|)((?:\s+)sicut)?\b//i)
825 {
826 0 ▶ if ($4)
Branch: 1 branch
BranchTrueFalseTotal
if ($4) { } 0 0 0
827 {
828 0 ▶ my $token = $3 ? $1.$3 : $1;
Branch: 1 branch
BranchTrueFalseTotal
$3 ? : 0 0 0
829 0 push @tokens, token($token,'NAME',$token,'Name');
830 }
831 else
832 {
833 0 ▶ push @tokens, tokdup $connectives{lc $3} if $3;
Branch: 1 branch
BranchTrueFalseTotal
if $3 0 0 0
834 0 push @tokens, token($1,'DATIVE',"\%$2",'Literal');
835 }
836 }
837 elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)us)(que|ve|)((?:\s+)sicut)?\b//i)
838 {
839 0 ▶ if ($4)
Branch: 1 branch
BranchTrueFalseTotal
if ($4) { } 0 0 0
840 {
841 0 ▶ my $token = $3 ? $1.$3 : $1;
Branch: 1 branch
BranchTrueFalseTotal
$3 ? : 0 0 0
842 0 push @tokens, token($token,'Name',$token,'Name');
843 }
844 else
845 {
846 0 ▶ push @tokens, tokdup $connectives{lc $3} if $3;
Branch: 1 branch
BranchTrueFalseTotal
if $3 0 0 0
847 0 push @tokens, token($1,'ACCUSATIVE',"\%$2",'Literal');
848 }
849 }
850 elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)o)(que|ve|)((?:\s+)sicut)?\b//i)
851 {
852 0 ▶ if ($4)
Branch: 1 branch
BranchTrueFalseTotal
if ($4) { } 0 0 0
853 {
854 0 ▶ my $token = $3 ? $1.$3 : $1;
Branch: 1 branch
BranchTrueFalseTotal
$3 ? : 0 0 0
855 0 push @tokens, token($token,'NAME',$token,'Name');
856 }
857 else
858 {
859 0 ▶ push @tokens, tokdup $connectives{lc $3} if $3;
Branch: 1 branch
BranchTrueFalseTotal
if $3 0 0 0
860 0 push @tokens, token($1,'DATIVE',"\$$2",'Literal');
861 }
862 }
863 elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)is)(que|ve|)((?:\s+)sicut)?\b//i)
864 {
865 0 ▶ if ($4)
Branch: 1 branch
BranchTrueFalseTotal
if ($4) { } 0 0 0
866 {
867 0 ▶ my $token = $3 ? $1.$3 : $1;
Branch: 1 branch
BranchTrueFalseTotal
$3 ? : 0 0 0
868 0 push @tokens, token($token,'NAME',$token,'Name');
869 }
870 else
871 {
872 0 ▶ push @tokens, tokdup $connectives{lc $3} if $3;
Branch: 1 branch
BranchTrueFalseTotal
if $3 0 0 0
873 0 push @tokens, token($1,'DATIVE',"\@$2",'Literal');
874 }
875 }
876 elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)tori)(que|ve|)((?:\s+)sicut)?\b//i)
877 {
878 0 ▶ if ($4)
Branch: 1 branch
BranchTrueFalseTotal
if ($4) { } 0 0 0
879 {
880 0 ▶ my $token = $3 ? $1.$3 : $1;
Branch: 1 branch
BranchTrueFalseTotal
$3 ? : 0 0 0
881 0 push @tokens, token($token,'NAME',$token,'Name');
882 }
883 else
884 {
885 0 ▶ push @tokens, tokdup $connectives{lc $3} if $3;
Branch: 1 branch
BranchTrueFalseTotal
if $3 0 0 0
886 0 push @tokens, token($1,'DATIVE',"\\&$2",'Literal');
887 }
888 }
889 elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)i)(que|ve|)((?:\s+)sicut)?\b//i)
890 {
891 0 ▶ if ($4)
Branch: 1 branch
BranchTrueFalseTotal
if ($4) { } 0 0 0
892 {
893 0 ▶ my $token = $3 ? $1.$3 : $1;
Branch: 1 branch
BranchTrueFalseTotal
$3 ? : 0 0 0
894 0 push @tokens, token($token,'NAME',$token,'Name');
895 }
896 else
897 {
898 0 ▶ push @tokens, tokdup $connectives{lc $3} if $3;
Branch: 1 branch
BranchTrueFalseTotal
if $3 0 0 0
899 0 push @tokens, token($1,'GENITIVE',"\$$2",'Literal');
900 }
901 }
902 elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)ere)(que|ve|)((?:\s+)sicut)?\b//i)
903 {
904 2 ▶ if ($4)
Branch: 1 branch
BranchTrueFalseTotal
if ($4) { } 0 2 2
905 {
906 0 ▶ my $token = $3 ? $1.$3 : $1;
Branch: 1 branch
BranchTrueFalseTotal
$3 ? : 0 0 0
907 0 push @tokens, token($token,'NAME',$token,'Name');
908 }
909 else
910 {
911 2 ▶ push @tokens, tokdup $connectives{lc $3} if $3;
Branch: 1 branch
BranchTrueFalseTotal
if $3 0 2 2
912 2 push @tokens, token($1,'INFINITIVE',"$2",'Literal');
913 }
914 }
915 elsif ($text =~ s/\A(([a-z_][0-9a-z_]*?)(um|)e)(que|ve|)((?:\s+)sicut)?\b//i)
916 {
917 2 ▶ if ($5)
Branch: 1 branch
BranchTrueFalseTotal
if ($5) { } 0 2 2
918 {
919 0 ▶ my $token = $4 ? $1.$4 : $1;
Branch: 1 branch
BranchTrueFalseTotal
$4 ? : 0 0 0
920 0 push @tokens, token($token,'NAME',$token,'Name');
921 }
922 else
923 {
924 2 ▶ push @tokens, tokdup $connectives{lc $4} if $4;
Branch: 1 branch
BranchTrueFalseTotal
if $4 0 2 2
925 2 ▶ my $perl = $3 ? "\$$2->" : $2;
Branch: 1 branch
BranchTrueFalseTotal
$3 ? : 0 2 2
926 2 push @tokens, token($1,'SUBNAME',$perl,'Literal');
927 }
928 }
929 elsif ($text =~ s/\A(([a-z_][0-9a-z_]*)torem)(que|ve|)((?:\s+)sicut)?\b//i)
930 {
931 0 ▶ if ($4)
Branch: 1 branch
BranchTrueFalseTotal
if ($4) { } 0 0 0
932 {
933 0 ▶ my $token = $3 ? $1.$3 : $1;
Branch: 1 branch
BranchTrueFalseTotal
$3 ? : 0 0 0
934 0 push @tokens, token($token,'NAME',$token,'Name');
935 }
936 else
937 {
938 0 ▶ push @tokens, tokdup $connectives{lc $3} if $3;
Branch: 1 branch
BranchTrueFalseTotal
if $3 0 0 0
939 0 push @tokens, token($1,'ACCUSATIVE',"\\&$2",'Literal');
940 }
941 }
942 elsif ($text =~ s/\A([.])//)
943 {
944 4 push @tokens, token($1,'PERIOD',";",'Separator');
945 }
946 elsif ($text =~ s/\A(\S+)(que|ve|)((?:\s+)sicut)?\b//)
947 {
948 2 ▶ if ($3)
Branch: 1 branch
BranchTrueFalseTotal
if ($3) { } 0 2 2
949 {
950 0 ▶ my $token = $2 ? $1.$2 : $1;
Branch: 1 branch
BranchTrueFalseTotal
$2 ? : 0 0 0
951 0 ▶ push @tokens, token($token,'NAME',$token,'Name') if $token;
Branch: 1 branch
BranchTrueFalseTotal
if $token 0 0 0
952 }
953 else
954 {
955 2 ▶ push @tokens, tokdup $connectives{lc $2} if $2;
Branch: 1 branch
BranchTrueFalseTotal
if $2 0 2 2
956 2 ▶ push @tokens, token($1,'NAME',"$1",'Name') if $1;
Branch: 1 branch
BranchTrueFalseTotal
if $1 2 0 2
957 }
958 }
959 else
960 {
961 2 ▶ $text =~ s/\A(\S+)// or next;
Branch: 1 branch
BranchTrueFalseTotal
$text =~ s/\A(\S+)// or next 2 0 2
962 0 my $error = $1;
963 0 $bad .= "Aliquod barbarum inveni: '$error'"
964 . adversum({line=>$line});
965 }
966 54 ▶ $tokens[-1]->{line} = $line if @tokens;
Branch: 1 branch
BranchTrueFalseTotal
if @tokens 54 0 54
967 }
968 4 ▶ if (($lex ||$debug) && @tokens) {
Branch: 1 branch
BranchTrueFalseTotal
if ($lex || $debug and @tokens) 0 4 4
Condition33%2/6
$lex || $debug and @tokens
!ll&&!rl&&r
400
$lex or $debug
l!l&&r!l&&!r
004
MC/DC0%0/3
$lex || $debug and @tokens
$lex $debug @tokens
Truth table20%1/5
A or B and C
A= $lexB= $debugC= @tokens
ABCresult
00X0
1X00
0100
1X11
0111
969 0 my $format = "%-20s %-10s %-20s\n";
970 0 printf $format, qw(Word Role Meaning);
971 0 printf $format, qw(==== ==== =======);
972 0 foreach ( @tokens ) {
973 0 printf $format, @{$_}{qw(raw lex perl)};
974 }
975 0 print "\n", "="x72, "\n\n";
976 0 ▶ die "\n" if $lex;
Branch: 1 branch
BranchTrueFalseTotal
if $lex 0 0 0
977 }
978  
979 4 ▶ die $bad if $bad;
Branch: 1 branch
BranchTrueFalseTotal
if $bad 0 4 4
980 4 return [@tokens];
981 }
982  
983 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
984  
985 sub conn_command {
986 10 ▶ my ($toks, $eatend, $noeatend) = @_;
Subroutine conn_command: called CC=3 SCAR=13.6
Pod undocumented
987 10 my $command = &command;
988 10 ▶ while (@$toks && $toks->[0]{lex} eq 'CONNECTIVE') {
Branch: 1 branch
BranchTrueFalseTotal
if (@$toks and $toks->[0]{"lex"} eq "CONNECTIVE") 0 10 10
Condition66%2/3
@$toks and $toks->[0]{"lex"} eq "CONNECTIVE"
!ll&&!rl&&r
280
MC/DC0%0/2
@$toks and $toks->[0]{"lex"} eq "CONNECTIVE"
@$toks $toks->[0]{"lex"} eq "CONNECTIVE"
Truth table66%2/3
A and B
A= @$toksB= $toks->[0]{"lex"} eq "CONNECTIVE"
ABresult
0X0
100
111
989 0 local $Lingua::Romana::Perligata::connective = shift @$toks;
990 0 $connective->{L} = $command;
991 0 $connective->{R} = &command;
992 0 $command = $connective;
993 }
994 10 return $command;
995 }
996  
997  
998 sub command {
999 10 ▶ my ($toks, $eatend, $noeatend) = @_;
Subroutine command: called CC=71 SCAR=64.0
Pod undocumented
1000 10 my @Astack = { data => [], complete => 1 }; #SENTINEL ACCUSATIVE FRAME
1001 10 my (@Bstack, @Dstack, @Vstack, $Vdone);
1002 10 my $Dindir = 0;
1003 10 my @lastsubstantive;
1004 10 my $empty = 1;
1005  
1006 10 my $reduce;
1007 my $Astack_push = sub {
1008 14 ▶ if ($Astack[-1]{complete}) {
Subroutine __ANON__: called CC=3 SCAR=11.0
Branch: 1 branch
BranchTrueFalseTotal
if ($Astack[-1]{'complete'}) { } 6 8 14
1009 6 ▶ $reduce->($_[0]) if @Astack > 1;
Branch: 1 branch
BranchTrueFalseTotal
if @Astack > 1 0 6 6
1010 6 push @Astack, { data => [ $_[0] ] };
1011 }
1012 else {
1013 8 push @{$Astack[-1]{data}}, $_[0];
1014 }
1015 14 $Astack[-1]{complete} = 1;
1016 10 };
1017  
1018 $reduce = sub {
1019 24 ▶ my ($lookahead) = @_;
Subroutine __ANON__: called CC=33 SCAR=49.8
1020 24 ▶ if (! @Vstack) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@Vstack) 12 12 24
1021 12 ▶ if (@Dstack && ($Dstack[-1]{V}{lex}||"") eq 'OWNER_D') {
Branch: 1 branch
BranchTrueFalseTotal
if (@Dstack and ($Dstack[-1]{"V"}{"lex"} || "") eq "OWNER_D") 0 12 12
Condition60%3/5
@Dstack and ($Dstack[-1]{"V"}{"lex"} || "") eq "OWNER_D"
!ll&&!rl&&r
1020
$Dstack[-1]{'V'}{'lex'} || ''
l!l
20
MC/DC50%1/2
@Dstack and ($Dstack[-1]{"V"}{"lex"} || "") eq "OWNER_D"
@Dstack $Dstack[-1]{'V'}{'lex'}
Truth table66%2/3
A and B
A= @DstackB= $Dstack[-1]{'V'}{'lex'}
ABresult
0X0
100
111
1022 0 $Vdone = pop @Dstack;
1023 0 return 1
1024 }
1025 12 return 0;
1026 }
1027 12 ▶ return 0 if $Vstack[-1]{lex} =~ /^SUBNAME_?A?D?$/ && $lookahead->{lex} !~ /PERIOD|DO|END|CONNECTIVE/
Branch: 1 branch
BranchTrueFalseTotal
if $Vstack[-1]{"lex"} =~ /^SUBNAME_?A?D?$/ and not $lookahead->{"lex"} =~ /PERIOD|DO|END|CONNECTIVE/ or ref $Vstack[-1] eq "STATEMENT" 6 6 12
Condition83%5/6
$Vstack[-1]{"lex"} =~ /^SUBNAME_?A?D?$/ and not $lookahead->{"lex"} =~ /PERIOD|DO|END|CONNECTIVE/ or ref $Vstack[-1] eq "STATEMENT"
l!l&&r!l&&!r
606
$Vstack[-1]{"lex"} =~ /^SUBNAME_?A?D?$/ and not $lookahead->{"lex"} =~ /PERIOD|DO|END|CONNECTIVE/
!ll&&!rl&&r
246
MC/DC66%2/3
$Vstack[-1]{"lex"} =~ /^SUBNAME_?A?D?$/ and not $lookahead->{"lex"} =~ /PERIOD|DO|END|CONNECTIVE/ or ref $Vstack[-1] eq "STATEMENT"
$Vstack[-1]{"lex"} =~ /^SUBNAME_?A?D?$/ not $lookahead->{"lex"} =~ /PERIOD|DO|END|CONNECTIVE/ ref $Vstack[-1] eq "STATEMENT"
Truth table60%3/5
A and not(B) or C
A= $Vstack[-1]{"lex"} =~ /^SUBNAME_?A?D?$/B= not $lookahead->{"lex"} =~ /PERIOD|DO|END|CONNECTIVE/C= ref $Vstack[-1] eq "STATEMENT"
ABCresult
11X1
0X11
1011
0X00
1000
1028 || ref $Vstack[-1] eq "STATEMENT";
1029 6 my $verb = $Vstack[-1];
1030 6 my ($needA, $needD) = $verb->{lex} =~ /_(O?A?)([BD])?/;
1031 6 ▶ $needA ||= $verb->{lex} eq 'SUBNAME' ? "OA" : "";
Branch: 1 branch
BranchTrueFalseTotal
$verb->{'lex'} eq 'SUBNAME' ? : 2 0 2
Condition66%2/3
$needA ||= $verb->{"lex"} eq "SUBNAME" ? "OA" : ""
l!l&&r!l&&!r
420
MC/DC0%0/2
$needA ||= $verb->{"lex"} eq "SUBNAME" ? "OA" : ""
$needA $verb->{"lex"} eq "SUBNAME" ? "OA" : ""
Truth table66%2/3
A ||= B
A= $needAB= $verb->{"lex"} eq "SUBNAME" ? "OA" : ""
ABresult
1X1
011
000
1032 6 ▶ $needD ||= "";
Condition100%2/2
$needD ||= ""
l!l
24
MC/DC100%1/1
$needD ||= ""
$needD
Truth table100%2/2
A
A= $needD
Aresult
11
00
1033 return 0 if $needA && $needA ne "OA" && (@Astack<=1 || !$Astack[-1]{complete})
1034 6 ▶ || $needD eq 'D' && !@Dstack
Branch: 1 branch
BranchTrueFalseTotal
if $needA and $needA ne "OA" and @Astack <= 1 || !$Astack[-1]{"complete"} or $needD eq "D" and not @Dstack or $needD eq "B" and not @Bstack 0 6 6
Condition47%10/21
$needA and $needA ne "OA" and @Astack <= 1 || !$Astack[-1]{"complete"} or $needD eq "D" and not @Dstack or $needD eq "B" and not @Bstack
l!l&&r!l&&!r
006
$needA and $needA ne "OA" and @Astack <= 1 || !$Astack[-1]{"complete"} or $needD eq "D" and not @Dstack
l!l&&r!l&&!r
006
$needA and $needA ne "OA" and @Astack <= 1 || !$Astack[-1]{"complete"}
!ll&&!rl&&r
240
$needA and $needA ne "OA"
!ll&&!rl&&r
024
@Astack <= 1 or not $Astack[-1]{"complete"}
l!l&&r!l&&!r
004
$needD eq "D" and not @Dstack
!ll&&!rl&&r
420
$needD eq "B" and not @Bstack
!ll&&!rl&&r
600
MC/DC0%0/8
$needA and $needA ne "OA" and @Astack <= 1 || !$Astack[-1]{"complete"} or $needD eq "D" and not @Dstack or $needD eq "B" and not @Bstack
$needA $needA ne "OA" @Astack <= 1 not $Astack[-1]{"complete"} $needD eq "D" not @Dstack $needD eq "B" not @Bstack
Truth table0%0/23
A and B and C or not(D) or E and not(F) or G and not(H)
A= $needAB= $needA ne "OA"C= @Astack <= 1D= not $Astack[-1]{"complete"}E= $needD eq "D"F= not @DstackG= $needD eq "B"H= not @Bstack
ABCDEFGHresult
111XXXXX1
1101XXXX1
0XXX11XX1
10XX11XX1
110011XX1
0XXX0X111
0XXX10111
10XX0X111
10XX10111
11000X111
110010111
0XXX0X0X0
0XXX0X100
0XXX100X0
0XXX10100
10XX0X0X0
10XX0X100
10XX100X0
10XX10100
11000X0X0
11000X100
1100100X0
110010100
1035 || $needD eq 'B' && !@Bstack;
1036 6 ▶ my $dat = $needD eq 'D' ? pop(@Dstack)
Branch: 2 branches
BranchTrueFalseTotal
$needD eq 'D' ? : 2 4 6
$needD eq 'B' ? : 0 4 4
1037 : $needD eq 'B' ? pop(@Bstack)
1038 : undef;
1039 6 ▶ my $acc = $needA && @Astack>1 ? pop(@Astack)->{data} : undef;
Branch: 1 branch
BranchTrueFalseTotal
$needA && @Astack > 1 ? : 6 0 6
Condition33%1/3
$needA and @Astack > 1
!ll&&!rl&&r
006
MC/DC0%0/2
$needA and @Astack > 1
$needA @Astack > 1
Truth table33%1/3
A and B
A= $needAB= @Astack > 1
ABresult
0X0
100
111
1040 6 my $statement = bless { V=>pop(@Vstack), A=>$acc, D=>$dat }, "STATEMENT";
1041 6 ▶ if ($verb->{lex} =~ /SUBNAME_.*_ACCUSATIVE/
Branch: 3 branches
BranchTrueFalseTotal
if ($verb->{'lex'} =~ /SUBNAME_.*_ACCUSATIVE/ or $Dindir and $verb->{'lex'} =~ /SUBNAME_.*_DATIVE|OWNER_D/) { } 0 6 6
elsif ($verb->{'lex'} =~ /SUBNAME_.*_DATIVE|OWNER_D/) { } 2 4 6
elsif ($verb->{'lex'} =~ /SUBNAME_.*_GENITIVE/) { } 0 4 4
Condition33%2/6
$verb->{"lex"} =~ /SUBNAME_.*_ACCUSATIVE/ or $Dindir and $verb->{"lex"} =~ /SUBNAME_.*_DATIVE|OWNER_D/
l!l&&r!l&&!r
006
$Dindir and $verb->{"lex"} =~ /SUBNAME_.*_DATIVE|OWNER_D/
!ll&&!rl&&r
600
MC/DC0%0/3
$verb->{"lex"} =~ /SUBNAME_.*_ACCUSATIVE/ or $Dindir and $verb->{"lex"} =~ /SUBNAME_.*_DATIVE|OWNER_D/
$verb->{"lex"} =~ /SUBNAME_.*_ACCUSATIVE/ $Dindir $verb->{"lex"} =~ /SUBNAME_.*_DATIVE|OWNER_D/
Truth table25%1/4
A or B and C
A= $verb->{"lex"} =~ /SUBNAME_.*_ACCUSATIVE/B= $DindirC= $verb->{"lex"} =~ /SUBNAME_.*_DATIVE|OWNER_D/
ABCresult
1XX1
0111
00X0
0100
1042 || $Dindir && $verb->{lex} =~ /SUBNAME_.*_DATIVE|OWNER_D/ )
1043 {
1044 0 ▶ if ($verb->{lex} =~ /SUBNAME_.*_DATIVE|OWNER_D/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($verb->{"lex"} =~ /SUBNAME_.*_DATIVE|OWNER_D/) 0 0 0
1045 0 $statement->{R} = $Dindir;
1046 0 $Dindir = 0;
1047 }
1048 0 $Astack_push->($statement);
1049 0 push @lastsubstantive, $Astack[-1]{data};
1050 }
1051 elsif ($verb->{lex} =~ /SUBNAME_.*_DATIVE|OWNER_D/ ) {
1052 2 push @Dstack, $statement;
1053 2 push @lastsubstantive, \@Dstack;
1054 }
1055 elsif ($verb->{lex} =~ /SUBNAME_.*_GENITIVE/ ) {
1056 0 my $lastsubstantive = pop @lastsubstantive;
1057 0 ▶ die "Genitivum non junctum: '$ord->{raw}'"
Branch: 1 branch
BranchTrueFalseTotal
unless $lastsubstantive 0 0 0
1058 . adversum($verb)
1059 unless $lastsubstantive;
1060 0 $ord = $lastsubstantive[-1][-1];
1061 die "Index '$ord->{raw}' ordinalis non est"
1062 . adversum($ord)
1063 0 ▶ if $ord->{lex} && $ord->{lex} eq 'NUMERAL';
Branch: 1 branch
BranchTrueFalseTotal
if $ord->{"lex"} and $ord->{"lex"} eq "NUMERAL" 0 0 0
Condition0%0/3
$ord->{"lex"} and $ord->{"lex"} eq "NUMERAL"
!ll&&!rl&&r
000
MC/DC0%0/2
$ord->{"lex"} and $ord->{"lex"} eq "NUMERAL"
$ord->{"lex"} $ord->{"lex"} eq "NUMERAL"
Truth table0%0/3
A and B
A= $ord->{"lex"}B= $ord->{"lex"} eq "NUMERAL"
ABresult
0X0
100
111
1064 0 push @{$ord->{G}}, $statement;
1065 0 push @lastsubstantive, $Astack[-1]{data};
1066 }
1067 4 else { $Vdone = $statement }
1068 6 ▶ if ($debug) {
Branch: 1 branch
BranchTrueFalseTotal
if ($debug) 0 6 6
1069 0 print "reduced: ", Data::Dumper->Dump([$statement]);
1070 }
1071 6 return 1;
1072 10 };
1073  
1074 10 my $tok;
1075 10 ▶ while ( $tok = $toks->[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tok = $toks->[0]) 42 0 42
1076 42 ▶ if ($debug) {
Branch: 1 branch
BranchTrueFalseTotal
if ($debug) 0 42 42
1077 0 print "Next: '$toks->[0]{raw}' ($toks->[0]{lex}):\n";
1078 }
1079 42 ▶ if ($tok->{lex} =~ /^(NUMERAL|ORDINAL)$/
Branch: 20 branches
BranchTrueFalseTotal
if ($tok->{'lex'} =~ /^(NUMERAL|ORDINAL)$/ or $Dindir and $tok->{'lex'} eq 'ORDINAL_DATIVE') { } 6 36 42
elsif ($tok->{'lex'} eq 'ORDINAL_DATIVE') { } 0 36 36
elsif ($tok->{'lex'} eq 'WITH') { } 0 36 36
elsif ($tok->{'lex'} =~ /^(?:ACCUSATIVE|NAME)$/ or $Dindir and $tok->{'lex'} eq 'DATIVE') { } 8 28 36
elsif ($tok->{'lex'} eq 'ARROW') { } 0 28 28
elsif ($tok->{'lex'} eq 'WITHIN') { } 0 28 28
elsif ($tok->{'lex'} eq 'GENITIVE') { } 2 26 28
elsif ($tok->{'lex'} eq 'INFINITIVE') { } 2 24 26
elsif ($tok->{'lex'} eq 'CONTROL') { } 0 24 24
elsif ($tok->{'lex'} eq 'FOR') { } 2 22 24
elsif ($tok->{'lex'} eq 'BEGIN') { } 0 22 22
elsif ($tok->{'lex'} eq 'OWNER_D') { } 0 22 22
elsif ($tok->{'lex'} eq 'COMMA') { } 8 14 22
elsif ($tok->{'lex'} eq 'ADDRESS') { } 0 14 14
elsif ($tok->{'lex'} eq 'DATIVE') { } 2 12 14
elsif ($tok->{'lex'} =~ /^SUBNAME/) { } 6 6 12
elsif ($tok->{'lex'} =~ /PERIOD/) { } 4 2 6
elsif ($tok->{'lex'} =~ /CONNECTIVE/) { } 0 2 2
elsif ($eatend and $tok->{'lex'} =~ /$eatend/) { } 2 0 2
elsif ($noeatend and $tok->{'lex'} =~ /$noeatend/) { } 0 0 0
Condition50%3/6
$tok->{"lex"} =~ /^(NUMERAL|ORDINAL)$/ or $Dindir and $tok->{"lex"} eq "ORDINAL_DATIVE"
l!l&&r!l&&!r
6036
$Dindir and $tok->{"lex"} eq "ORDINAL_DATIVE"
!ll&&!rl&&r
3600
MC/DC33%1/3
$tok->{"lex"} =~ /^(NUMERAL|ORDINAL)$/ or $Dindir and $tok->{"lex"} eq "ORDINAL_DATIVE"
$tok->{"lex"} =~ /^(NUMERAL|ORDINAL)$/ $Dindir $tok->{"lex"} eq "ORDINAL_DATIVE"
Truth table50%2/4
A or B and C
A= $tok->{"lex"} =~ /^(NUMERAL|ORDINAL)$/B= $DindirC= $tok->{"lex"} eq "ORDINAL_DATIVE"
ABCresult
1XX1
0111
00X0
0100
1080 || $Dindir && $tok->{lex} eq 'ORDINAL_DATIVE')
1081 6 { shift @$toks;
1082 6 ▶ if ($1 eq 'NUMERAL' && $toks->[0]{lex} eq 'ORDINAL') {
Branch: 1 branch
BranchTrueFalseTotal
if ($1 eq "NUMERAL" and $toks->[0]{"lex"} eq "ORDINAL") 0 6 6
Condition66%2/3
$1 eq "NUMERAL" and $toks->[0]{"lex"} eq "ORDINAL"
!ll&&!rl&&r
240
MC/DC0%0/2
$1 eq "NUMERAL" and $toks->[0]{"lex"} eq "ORDINAL"
$1 eq "NUMERAL" $toks->[0]{"lex"} eq "ORDINAL"
Truth table66%2/3
A and B
A= $1 eq "NUMERAL"B= $toks->[0]{"lex"} eq "ORDINAL"
ABresult
0X0
100
111
1083 0 $tok->{raw} .= " " . $toks->[0]{raw};
1084 0 $tok->{perl} /= $toks->[0]{perl};
1085 0 shift @$toks;
1086 }
1087 6 ▶ if ($tok->{lex} eq 'ORDINAL_DATIVE') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tok->{"lex"} eq "ORDINAL_DATIVE") 0 6 6
1088 0 $tok->{R} = $Dindir;
1089 0 $Dindir = 0;
1090 }
1091 6 $Astack_push->($tok);
1092 6 $lastownable = $Astack[-1]{data};
1093 6 push @lastsubstantive, $lastownable;
1094 }
1095 elsif ($tok->{lex} eq 'ORDINAL_DATIVE')
1096 0 { shift @$toks;
1097 0 $reduce->($tok);
1098 0 push @Dstack, $tok;
1099 0 $lastownable = \@Dstack;
1100 0 push @lastsubstantive, $lastownable;
1101 }
1102 elsif ($tok->{lex} eq 'WITH') {
1103 0 push @Astack, { data=>[], complete=>0 };
1104 0 shift @$toks;
1105 }
1106 ▶ elsif ($tok->{lex} =~ /^(?:ACCUSATIVE|NAME)$/
Condition50%3/6
$tok->{"lex"} =~ /^(?:ACCUSATIVE|NAME)$/ or $Dindir and $tok->{"lex"} eq "DATIVE"
l!l&&r!l&&!r
8028
$Dindir and $tok->{"lex"} eq "DATIVE"
!ll&&!rl&&r
2800
MC/DC33%1/3
$tok->{"lex"} =~ /^(?:ACCUSATIVE|NAME)$/ or $Dindir and $tok->{"lex"} eq "DATIVE"
$tok->{"lex"} =~ /^(?:ACCUSATIVE|NAME)$/ $Dindir $tok->{"lex"} eq "DATIVE"
Truth table50%2/4
A or B and C
A= $tok->{"lex"} =~ /^(?:ACCUSATIVE|NAME)$/B= $DindirC= $tok->{"lex"} eq "DATIVE"
ABCresult
1XX1
0111
00X0
0100
1107 || $Dindir && $tok->{lex} eq 'DATIVE')
1108 8 ▶ { if ($tok->{lex} eq 'DATIVE') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tok->{"lex"} eq "DATIVE") 0 8 8
1109 0 $tok->{R} = $Dindir;
1110 0 $Dindir = 0;
1111 }
1112 8 $Astack_push->($tok);
1113 8 shift @$toks;
1114 8 $lastownable = $Astack[-1]{data};
1115 8 push @lastsubstantive, $lastownable;
1116 }
1117 elsif ( $tok->{lex} eq 'ARROW' ) {
1118 0 my $owner = $toks->[1];
1119 my $perl = $owner->{perl} =~ /^\W/
1120 ? $owner->{perl}
1121 0 ▶ : "$owner->{raw}::";
Branch: 1 branch
BranchTrueFalseTotal
$owner->{'perl'} =~ /^\W/ ? : 0 0 0
1122 $lastownable->[-1]->{perl}
1123 0 =~ s{^}{$perl->};
1124 0 splice @$toks, 0, 2;
1125 }
1126 elsif ( $tok->{lex} eq 'WITHIN' ) {
1127 0 my $owner = $toks->[1];
1128 $lastownable->[-1]->{raw}
1129 0 =~ s{^(\W*)}{$1$owner->{raw}::};
1130 $lastownable->[-1]->{perl}
1131 0 =~ s{^(\W*)}{$1$owner->{raw}::};
1132 0 splice @$toks, 0, 2;
1133 }
1134 elsif ( $tok->{lex} eq 'GENITIVE' ) {
1135 2 $reduce->($tok);
1136 2 my $gen = shift @$toks;
1137 2 ▶ die "Genitivum indominum: '$ord->{raw}'"
Branch: 1 branch
BranchTrueFalseTotal
unless @lastsubstantive 0 2 2
1138 . adversum($gen)
1139 unless @lastsubstantive;
1140 2 $ord = $lastsubstantive[-1][-1];
1141 die "Index '$ord->{raw}' ordinalis non est"
1142 . adversum($ord)
1143 2 ▶ if $ord->{lex} && $ord->{lex} eq 'NUMERAL';
Branch: 1 branch
BranchTrueFalseTotal
if $ord->{"lex"} and $ord->{"lex"} eq "NUMERAL" 0 2 2
Condition33%1/3
$ord->{"lex"} and $ord->{"lex"} eq "NUMERAL"
!ll&&!rl&&r
020
MC/DC0%0/2
$ord->{"lex"} and $ord->{"lex"} eq "NUMERAL"
$ord->{"lex"} $ord->{"lex"} eq "NUMERAL"
Truth table33%1/3
A and B
A= $ord->{"lex"}B= $ord->{"lex"} eq "NUMERAL"
ABresult
0X0
100
111
1144 2 push @{$ord->{G}}, $gen;
1145 2 $lastownable = $ord->{G};
1146 }
1147 elsif ( $tok->{lex} eq 'INFINITIVE' )
1148 2 { $reduce->($tok); $Vdone = subdefn($toks); last }
1149 elsif ( $tok->{lex} eq 'CONTROL' )
1150 0 { $reduce->($tok); $Vdone = control($toks, \@Bstack); last }
1151 elsif ( $tok->{lex} eq 'FOR' )
1152 2 { $reduce->($tok); $Vdone = for_control($toks, \@Bstack); last }
1153 elsif ( $tok->{lex} eq 'BEGIN' )
1154 0 { push @Bstack, block($toks) }
1155 elsif ( $tok->{lex} eq 'OWNER_D' )
1156 0 { $reduce->($tok); push @Vstack, $tok; shift @$toks; }
1157 elsif ( $tok->{lex} eq 'COMMA' )
1158 { $reduce->($tok)
1159 unless $lastownable && @Astack>1 &&
1160 8 ▶ $lastownable == $Astack[-1]{data};
Branch: 1 branch
BranchTrueFalseTotal
unless $lastownable and @Astack > 1 and $lastownable == $Astack[-1]{"data"} 2 6 8
Condition50%3/6
$lastownable and @Astack > 1 and $lastownable == $Astack[-1]{"data"}
!ll&&!rl&&r
026
$lastownable and @Astack > 1
!ll&&!rl&&r
008
MC/DC33%1/3
$lastownable and @Astack > 1 and $lastownable == $Astack[-1]{"data"}
$lastownable @Astack > 1 $lastownable == $Astack[-1]{"data"}
Truth table50%2/4
A and B and C
A= $lastownableB= @Astack > 1C= $lastownable == $Astack[-1]{"data"}
ABCresult
0XX0
10X0
1100
1111
1161 die "'$tok->{raw}' immaturum est " . adversum($tok)
1162 8 ▶ unless @Astack>1 && $Astack[-1]{complete};
Branch: 1 branch
BranchTrueFalseTotal
unless @Astack > 1 and $Astack[-1]{"complete"} 0 8 8
Condition33%1/3
@Astack > 1 and $Astack[-1]{"complete"}
!ll&&!rl&&r
008
MC/DC0%0/2
@Astack > 1 and $Astack[-1]{"complete"}
@Astack > 1 $Astack[-1]{"complete"}
Truth table33%1/3
A and B
A= @Astack > 1B= $Astack[-1]{"complete"}
ABresult
0X0
100
111
1163 8 $Astack[-1]{complete} = 0;
1164 8 shift @$toks;
1165 }
1166 elsif ( $tok->{lex} eq 'ADDRESS' )
1167 0 { $reduce->($tok);
1168 0 $Dindir++;
1169 0 shift @$toks;
1170 }
1171 elsif ( $tok->{lex} eq 'DATIVE' )
1172 2 { $reduce->($tok); push @Dstack, $tok; shift @$toks;
1173 2 $lastownable = \@Dstack;
1174 2 push @lastsubstantive, $lastownable;
1175 }
1176 elsif ( $tok->{lex} =~ /^SUBNAME/ ) # WAS: /SUBNAME_
1177 6 ▶ { if ($Astack[-1]{complete}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($Astack[-1]{'complete'}) { } 6 0 6
elsif (not $tok->{'perl'} =~ /^(and|or|[&|]{2})$/) { } 0 0 0
1178 6 $reduce->($tok)
1179 }
1180 elsif ($tok->{perl} !~ /^(and|or|[&|]{2})$/) {
1181 0 push @Astack, { data=>[] };
1182 }
1183 6 push @Vstack, $tok; shift @$toks;
1184 6 $lastownable = \@Vstack;
1185 }
1186 # elsif ( $tok->{lex} =~ /^SUBNAME$/ )
1187 # { if ($Astack[-1]{complete}) {
1188 # $reduce->($tok)
1189 # }
1190 # elsif ($tok->{perl} !~ /^[&|]{2}$/ {
1191 # push @Astack, { data=>[] };
1192 # }
1193 # push @Vstack, $tok; shift @$toks;
1194 # $lastownable = \@Vstack;
1195 # }
1196 elsif ( $tok->{lex} =~ /PERIOD/ )
1197 4 ▶ { 1 while $reduce->($tok) && !$Vdone;
Branch: 1 branch
BranchTrueFalseTotal
&$reduce($tok) and not $Vdone and do { '???' } 0 4 4
Condition33%1/3
&$reduce($tok) and not $Vdone
!ll&&!rl&&r
040
MC/DC0%0/2
&$reduce($tok) and not $Vdone
&$reduce($tok) not $Vdone
Truth table33%1/3
A and not(B)
A= &$reduce($tok)B= not $Vdone
ABresult
0X0
100
111
1198 $Vdone = pop(@Astack)->{data}
1199 4 ▶ if $Lingua::Romana::Perligata::connective
Branch: 1 branch
BranchTrueFalseTotal
if $connective and not $Vdone || @Astack <= 1 0 4 4
Condition16%1/6
$connective and not $Vdone || @Astack <= 1
!ll&&!rl&&r
400
$Vdone || @Astack <= 1
l!l&&r!l&&!r
000
MC/DC0%0/3
$connective and not $Vdone || @Astack <= 1
$connective $Vdone @Astack <= 1
Truth table25%1/4
A and not(B || C)
A= $connectiveB= $VdoneC= @Astack <= 1
ABCresult
0XX0
11X0
1010
1001
1200 && !($Vdone || @Astack <= 1);
1201 4 shift @$toks;
1202 last
1203 4 }
1204 elsif ( $tok->{lex} =~ /CONNECTIVE/ )
1205 0 ▶ { 1 while $reduce->($tok) && !$Vdone;
Branch: 1 branch
BranchTrueFalseTotal
&$reduce($tok) and not $Vdone and do { '???' } 0 0 0
Condition0%0/3
&$reduce($tok) and not $Vdone
!ll&&!rl&&r
000
MC/DC0%0/2
&$reduce($tok) and not $Vdone
&$reduce($tok) not $Vdone
Truth table0%0/3
A and not(B)
A= &$reduce($tok)B= not $Vdone
ABresult
0X0
100
111
1206 $Vdone = pop(@Astack)->{data}
1207 0 ▶ unless $Vdone || @Astack <= 1;
Branch: 1 branch
BranchTrueFalseTotal
unless $Vdone or @Astack <= 1 0 0 0
Condition0%0/3
$Vdone or @Astack <= 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$Vdone or @Astack <= 1
$Vdone @Astack <= 1
Truth table0%0/3
A or B
A= $VdoneB= @Astack <= 1
ABresult
1X1
011
000
1208 0 last }
1209 ▶ elsif ( $eatend && $tok->{lex} =~ /$eatend/ )
Condition33%1/3
$eatend and $tok->{"lex"} =~ /$eatend/
!ll&&!rl&&r
002
MC/DC0%0/2
$eatend and $tok->{"lex"} =~ /$eatend/
$eatend $tok->{"lex"} =~ /$eatend/
Truth table33%1/3
A and B
A= $eatendB= $tok->{"lex"} =~ /$eatend/
ABresult
0X0
100
111
1210 2 ▶ { 1 while $reduce->($tok);
Branch: 1 branch
BranchTrueFalseTotal
&$reduce($tok) and do { '???' } 2 2 4
1211 $Vdone or $Vdone = @Astack > 1
1212 ? pop(@Astack)->{data}
1213 2 ▶ : pop @Dstack;
Branch: 2 branches
BranchTrueFalseTotal
$Vdone or $Vdone = @Astack > 1 ? pop(@Astack)->{"data"} : pop @Dstack 2 0 2
@Astack > 1 ? : 0 2 2
1214 2 shift @$toks; last }
1215 ▶ elsif ( $noeatend && $tok->{lex} =~ /$noeatend/ )
Condition0%0/3
$noeatend and $tok->{"lex"} =~ /$noeatend/
!ll&&!rl&&r
000
MC/DC0%0/2
$noeatend and $tok->{"lex"} =~ /$noeatend/
$noeatend $tok->{"lex"} =~ /$noeatend/
Truth table0%0/3
A and B
A= $noeatendB= $tok->{"lex"} =~ /$noeatend/
ABresult
0X0
100
111
1216 0 ▶ { 1 while $reduce->($tok);
Branch: 1 branch
BranchTrueFalseTotal
&$reduce($tok) and do { '???' } 0 0 0
1217 $Vdone or $Vdone = pop(@Astack)->{data}
1218 0 ▶ || pop @Dstack;
Branch: 1 branch
BranchTrueFalseTotal
$Vdone or $Vdone = pop(@Astack)->{"data"} || pop @Dstack 0 0 0
Condition0%0/3
pop(@Astack)->{'data'} || pop @Dstack
l!l&&r!l&&!r
000
MC/DC0%0/2
pop(@Astack)->{'data'} || pop @Dstack
pop(@Astack)->{'data'} pop @Dstack
Truth table0%0/3
A || B
A= pop(@Astack)->{'data'}B= pop @Dstack
ABresult
1X1
011
000
1219 0 last }
1220 else {
1221 0 die "Non intellexi: '$tok->{raw}'" . adversum($tok);
1222 }
1223 }
1224 continue {
1225 32 $empty = 0;
1226 32 ▶ if ($debug) {
Branch: 1 branch
BranchTrueFalseTotal
if ($debug) 0 32 32
1227 0 print "After '$tok->{raw}' ($tok->{lex}):\n";
1228 0 print Data::Dumper->Dump([\@Vstack, \@Astack, \@Bstack, \@Dstack, \@lastsubstantive, \$lastownable, \$Vdone], [qw{Vstack Astack Bstack Dstack LastS LastO Vdone}]);
1229 }
1230 }
1231 die "Iussum nefastum: '$Vstack[-1]{raw}'" . adversum($Vstack[-1])
1232 10 ▶ . ( $Vstack[-1]{lex} !~ /(ACCUSATIVE|DATIVE)$/
Branch: 2 branches
BranchTrueFalseTotal
if $Vdone and @Vstack 0 10 10
!($Vstack[-1]{'lex'} =~ /(ACCUSATIVE|DATIVE)$/) ? : 0 0 0
Condition33%1/3
$Vdone and @Vstack
!ll&&!rl&&r
0100
MC/DC0%0/2
$Vdone and @Vstack
$Vdone @Vstack
Truth table33%1/3
A and B
A= $VdoneB= @Vstack
ABresult
0X0
100
111
1233 ? "(Vellesne '$Vstack[-1]{raw}mentum' unumve ceteri)\n"
1234 : "" )
1235 if $Vdone && @Vstack;
1236 die "Accusativum non junctum: '"
1237 0 . join(" tum ", map {$_->{raw}} @{$Astack[-1]{data}})
1238 . "'"
1239 10 ▶ . adversum($Astack[-1]{data}[0])
Branch: 1 branch
BranchTrueFalseTotal
if @Astack > 1 and not @Vstack 0 10 10
Condition33%1/3
@Astack > 1 and not @Vstack
!ll&&!rl&&r
1000
MC/DC0%0/2
@Astack > 1 and not @Vstack
@Astack > 1 not @Vstack
Truth table33%1/3
A and not(B)
A= @Astack > 1B= not @Vstack
ABresult
0X0
100
111
1240 if @Astack > 1 && !@Vstack;
1241 10 ▶ die "Dativum non junctum: '$Dstack[-1]{raw}'" . adversum($Dstack[-1])
Branch: 1 branch
BranchTrueFalseTotal
if @Dstack and not @Vstack 0 10 10
Condition33%1/3
@Dstack and not @Vstack
!ll&&!rl&&r
1000
MC/DC0%0/2
@Dstack and not @Vstack
@Dstack not @Vstack
Truth table33%1/3
A and not(B)
A= @DstackB= not @Vstack
ABresult
0X0
100
111
1242 if @Dstack && !@Vstack;
1243 10 ▶ die "Sententia imperfecta prope '$tok->{raw}'" . adversum($tok)
Branch: 1 branch
BranchTrueFalseTotal
unless $Vdone or $empty 0 10 10
Condition33%1/3
$Vdone or $empty
l!l&&r!l&&!r
1000
MC/DC0%0/2
$Vdone or $empty
$Vdone $empty
Truth table33%1/3
A or B
A= $VdoneB= $empty
ABresult
1X1
011
000
1244 unless $Vdone || $empty;
1245 10 ▶ return $empty ? $tok
Branch: 2 branches
BranchTrueFalseTotal
$empty ? : 4 6 10
ref $Vdone eq 'ARRAY' ? : 0 6 6
1246 : ref $Vdone eq 'ARRAY' ? $Vdone->[0]
1247 : $Vdone;
1248 }
1249  
1250 sub block
1251 {
1252 4 ▶ my ($toks) = @_;
Subroutine block: called CC=5 SCAR=16.3
Pod undocumented
1253 4 my @self;
1254 4 my $next = shift @$toks;
1255 die "Exspectavi 'sic' sed inveni '$next->{raw}'" . adversum($next)
1256 4 ▶ unless $next->{lex} eq 'BEGIN';
Branch: 1 branch
BranchTrueFalseTotal
unless $next->{"lex"} eq "BEGIN" 0 4 4
1257 4 ▶ while ($toks->[0]{lex} ne 'END') {
Branch: 1 branch
BranchTrueFalseTotal
if ($toks->[0]{"lex"} ne "END") 4 4 8
1258 4 my $command = conn_command($_[0],'PERIOD','END');
1259 4 ▶ push @self, $command if $command;
Branch: 1 branch
BranchTrueFalseTotal
if $command 4 0 4
1260 }
1261 4 $next = shift @$toks;
1262 die "Exspectavi 'cis' sed inveni '$next->{raw}'" . adversum($next)
1263 4 ▶ unless $next->{lex} eq 'END';
Branch: 1 branch
BranchTrueFalseTotal
unless $next->{"lex"} eq "END" 0 4 4
1264 4 return bless \@self, 'BLOCK';
1265 }
1266  
1267 sub subdefn
1268 {
1269 2 ▶ my ($toks) = @_;
Subroutine subdefn: called CC=1 SCAR=0.0
Pod undocumented
1270 2 my $self = shift @$toks;
1271 2 $self->{B} = block($toks);
1272 2 return $self;
1273 }
1274  
1275 sub for_control
1276 {
1277 2 ▶ my ($toks, $Bstack) = @_;
Subroutine for_control: called CC=10 SCAR=32.1
Pod undocumented
1278 2 my $self = shift @$toks;
1279 2 my $var;
1280 $var = $toks->[0]{lex} eq 'ACCUSATIVE'
1281 ? shift @$toks
1282 : $toks->[0]{lex} ne 'IN'
1283 ? die "Exspectavi accusativum post 'per' sed inveni '$toks->[0]{raw}'" . adversum($toks->[0])
1284 2 ▶ : tokdup $tokens{'huic'};
Branch: 2 branches
BranchTrueFalseTotal
$toks->[0]{'lex'} eq 'ACCUSATIVE' ? : 2 0 2
$toks->[0]{'lex'} ne 'IN' ? : 0 0 0
1285 2 my $in = shift @$toks;
1286 die "'in' pro 'per' afuit" . adversum($in)
1287 2 ▶ unless $in->{lex} eq 'IN';
Branch: 1 branch
BranchTrueFalseTotal
unless $in->{"lex"} eq "IN" 0 2 2
1288 2 $self->{D} = $var;
1289 2 $self->{C} = conn_command($toks,'DO', 'PERIOD');
1290 2 ▶ unless (($self->{C}{lex}||$self->{C}{V}{lex}) =~ /DATIVE|OWNER_D/) {
Branch: 1 branch
BranchTrueFalseTotal
unless (($self->{"C"}{"lex"} || $self->{"C"}{"V"}{"lex"}) =~ /DATIVE|OWNER_D/) 0 2 2
Condition33%1/3
$self->{'C'}{'lex'} || $self->{'C'}{'V'}{'lex'}
l!l&&r!l&&!r
020
MC/DC0%0/2
$self->{'C'}{'lex'} || $self->{'C'}{'V'}{'lex'}
$self->{'C'}{'lex'} $self->{'C'}{'V'}{'lex'}
Truth table33%1/3
A || B
A= $self->{'C'}{'lex'}B= $self->{'C'}{'V'}{'lex'}
ABresult
1X1
011
000
1291 my ($badraw, $bad) = $self->{C}{lex}
1292 ? ($self->{C}{raw}, $self->{C})
1293 0 ▶ : ($self->{C}{V}{raw}, $self->{C}{V});
Branch: 1 branch
BranchTrueFalseTotal
$self->{'C'}{'lex'} ? : 0 0 0
1294 0 die "'$badraw' dativus non est in 'per'" . adversum($bad);
1295 }
1296 2 ▶ if ($toks->[0]{lex} =~ /PERIOD|CONNECTIVE/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($toks->[0]{'lex'} =~ /PERIOD|CONNECTIVE/) { } 0 2 2
1297 0 ▶ die "Iussa absentia per '$self->{raw}'" . adversum($self)
Branch: 1 branch
BranchTrueFalseTotal
unless @$Bstack 0 0 0
1298 unless @$Bstack;
1299 0 $self->{B} = pop @$Bstack;
1300 0 ▶ shift @$toks unless $toks->[0]{lex} eq 'CONNECTIVE';
Branch: 1 branch
BranchTrueFalseTotal
unless $toks->[0]{"lex"} eq "CONNECTIVE" 0 0 0
1301 }
1302 else {
1303 2 $self->{B} = block($toks);
1304 }
1305 2 return $self;
1306 }
1307  
1308 sub control
1309 {
1310 0 ▶ my ($toks, $Bstack) = @_;
Subroutine control: not called CC=9 SCAR=45.0
Pod documented
1311 0 my $self = shift @$toks;
1312 0 $self->{C} = conn_command($toks,'DO');
1313 0 ▶ if (($self->{perl}||"") eq 'while' &&
Branch: 1 branch
BranchTrueFalseTotal
if (($self->{"perl"} || "") eq "while" and ($self->{"C"}{"V"}{"perl"} || "") eq "Lingua::Romana::Perligata::getline") 0 0 0
Condition0%0/7
($self->{"perl"} || "") eq "while" and ($self->{"C"}{"V"}{"perl"} || "") eq "Lingua::Romana::Perligata::getline"
!ll&&!rl&&r
000
$self->{'perl'} || ''
l!l
00
$self->{'C'}{'V'}{'perl'} || ''
l!l
00
MC/DC0%0/2
($self->{"perl"} || "") eq "while" and ($self->{"C"}{"V"}{"perl"} || "") eq "Lingua::Romana::Perligata::getline"
$self->{'perl'} $self->{'C'}{'V'}{'perl'}
Truth table0%0/3
A and B
A= $self->{'perl'}B= $self->{'C'}{'V'}{'perl'}
ABresult
0X0
100
111
1314 ($self->{C}{V}{perl}||"") eq 'Lingua::Romana::Perligata::getline') {
1315 0 $self->{C}{V}{diamond} = 1;
1316 }
1317 0 ▶ if (!@$toks || $toks->[0]{lex} =~ /PERIOD|CONNECTIVE/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not @$toks or $toks->[0]{'lex'} =~ /PERIOD|CONNECTIVE/) { } 0 0 0
Condition0%0/3
not @$toks or $toks->[0]{"lex"} =~ /PERIOD|CONNECTIVE/
l!l&&r!l&&!r
000
MC/DC0%0/2
not @$toks or $toks->[0]{"lex"} =~ /PERIOD|CONNECTIVE/
not @$toks $toks->[0]{"lex"} =~ /PERIOD|CONNECTIVE/
Truth table0%0/3
not(A) or B
A= not @$toksB= $toks->[0]{"lex"} =~ /PERIOD|CONNECTIVE/
ABresult
1X1
011
000
1318 0 ▶ die "Iussa absentia per '$self->{raw}'" . adversum($self)
Branch: 1 branch
BranchTrueFalseTotal
unless @$Bstack 0 0 0
1319 unless @$Bstack;
1320 0 $self->{B} = pop @$Bstack;
1321 0 ▶ shift @$toks unless $toks->[0]{lex} eq 'CONNECTIVE';
Branch: 1 branch
BranchTrueFalseTotal
unless $toks->[0]{"lex"} eq "CONNECTIVE" 0 0 0
1322 }
1323 else {
1324 0 $self->{B} = block($toks);
1325 }
1326 0 return $self;
1327 }
1328  
1329  
1330 sub __enlist__ {
1331 2 ▶ return ($_[0]..$_[1]);
Subroutine __enlist__: called CC=1 SCAR=0.0
1332 }
1333  
1334 sub __enquote__ {
1335 0 ▶ return join " ", @_;
Subroutine __enquote__: not called CC=1 SCAR=6.9
1336 }
1337  
1338 sub __encatenate__ {
1339 0 ▶ return join "", @_;
Subroutine __encatenate__: not called CC=1 SCAR=6.9
1340 }
1341  
1342 sub __lastelem__(\@) {
1343 0 ▶ return $#{$_[0]};
Subroutine __lastelem__: not called CC=1 SCAR=6.9
1344 }
1345  
1346 2 my %lb = ( '@'=>'[', '%'=>'{' );
1347 2 my %rb = ( '@'=>']', '%'=>'}' );
1348  
1349 sub STATEMENT::translate {
1350 6 ▶ my $verb = $_[0]{V}->translate;
Subroutine translate: called CC=33 SCAR=57.2
1351 6 my $prefix = $_[0]{V}{prefix};
1352 6 my $hasblock = $verb =~ m{^(grep|map)$};
1353 my $noparen = $_[0]{V}{lex} eq 'OWNER_D' && $_[0]{V}{raw} =~ /o$/
1354 6 ▶ || $_[0]{V}{raw} =~ /^(finis|nuntius|factor(em|i))$/
Condition33%3/9
$_[0]{'V'}{'lex'} eq 'OWNER_D' && $_[0]{'V'}{'raw'} =~ /o$/ || $_[0]{'V'}{'raw'} =~ /^(finis|nuntius|factor(em|i))$/ || $hasblock
l!l&&r!l&&!r
006
$_[0]{"V"}{"lex"} eq "OWNER_D" and $_[0]{"V"}{"raw"} =~ /o$/ or $_[0]{"V"}{"raw"} =~ /^(finis|nuntius|factor(em|i))$/
l!l&&r!l&&!r
006
$_[0]{"V"}{"lex"} eq "OWNER_D" and $_[0]{"V"}{"raw"} =~ /o$/
!ll&&!rl&&r
600
MC/DC0%0/4
$_[0]{'V'}{'lex'} eq 'OWNER_D' && $_[0]{'V'}{'raw'} =~ /o$/ || $_[0]{'V'}{'raw'} =~ /^(finis|nuntius|factor(em|i))$/ || $hasblock
$_[0]{"V"}{"lex"} eq "OWNER_D" $_[0]{"V"}{"raw"} =~ /o$/ $_[0]{"V"}{"raw"} =~ /^(finis|nuntius|factor(em|i))$/ $hasblock
Truth table14%1/7
A and B or C || D
A= $_[0]{"V"}{"lex"} eq "OWNER_D"B= $_[0]{"V"}{"raw"} =~ /o$/C= $_[0]{"V"}{"raw"} =~ /^(finis|nuntius|factor(em|i))$/D= $hasblock
ABCDresult
11XX1
0X1X1
101X1
0X011
10011
0X000
10000
1355 || $hasblock;
1356 my $dative = defined $_[0]{D}
1357 ? $_[0]{D}->translate
1358 6 ▶ : "";
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]{'D'} ? : 2 4 6
1359 6 ▶ my $Dref = $verb =~ /^(bless)$/ && $dative =~ /^[%@]/ ? "\\" : "";
Branch: 1 branch
BranchTrueFalseTotal
$verb =~ /^(bless)$/ && $dative =~ /^[%\@]/ ? : 0 6 6
Condition33%1/3
$verb =~ /^(bless)$/ and $dative =~ /^[%\@]/
!ll&&!rl&&r
600
MC/DC0%0/2
$verb =~ /^(bless)$/ and $dative =~ /^[%\@]/
$verb =~ /^(bless)$/ $dative =~ /^[%\@]/
Truth table33%1/3
A and B
A= $verb =~ /^(bless)$/B= $dative =~ /^[%\@]/
ABresult
0X0
100
111
1360 6 ▶ $dative = $Dref . $dative if $dative;
Branch: 1 branch
BranchTrueFalseTotal
if $dative 2 4 6
1361 6 ▶ my $Dcomma = $dative && defined $_[0]{A} && !$hasblock && $verb !~ /^(print|printf)$/ ? "," : "";
Branch: 1 branch
BranchTrueFalseTotal
$dative && defined $_[0]{'A'} && !$hasblock && !($verb =~ /^(print|printf)$/) ? : 0 6 6
Condition66%6/9
$dative and defined $_[0]{"A"} and not $hasblock and not $verb =~ /^(print|printf)$/
!ll&&!rl&&r
420
$dative and defined $_[0]{"A"} and not $hasblock
!ll&&!rl&&r
402
$dative and defined $_[0]{"A"}
!ll&&!rl&&r
402
MC/DC0%0/4
$dative and defined $_[0]{"A"} and not $hasblock and not $verb =~ /^(print|printf)$/
$dative defined $_[0]{"A"} not $hasblock not $verb =~ /^(print|printf)$/
Truth table40%2/5
A and B and not(C) and not(D)
A= $dativeB= defined $_[0]{"A"}C= not $hasblockD= not $verb =~ /^(print|printf)$/
ABCDresult
0XXX0
10XX0
110X0
11100
11111
1362 6 ▶ if ($verb =~ /^(package|use)$/) {
Branch: 8 branches
BranchTrueFalseTotal
if ($verb =~ /^(package|use)$/) { } 0 6 6
elsif ($verb eq ':') { } 0 6 6
elsif ($_[0]{'V'}{'diamond'}) { } 0 6 6
elsif ($verb =~ /^[\$%\@]\{$/) { } 0 6 6
elsif (not $_[0]{'V'}{'operator'}) { } 6 0 6
elsif ($prefix and $dative) { } 0 0 0
elsif ($prefix) { } 0 0 0
elsif ($verb eq '=') { } 0 0 0
1363 0 return "$verb $_[0]{A}[0]{raw} ";
1364 }
1365 elsif ($verb eq ':') { # LABEL
1366 0 return " $_[0]{A}[0]{raw}: ";
1367 }
1368 elsif ($_[0]{V}{diamond}) {
1369 0 $result = "<" . substr($dative,1) . ">";
1370 }
1371 elsif ($verb =~ /^[\$%@]\{$/) {
1372 0 $result = $verb . $_[0]{A}[0]->translate . '}';
1373 }
1374 elsif (! $_[0]{V}{operator}) {
1375 $result = "$verb "
1376 . ($noparen ? "" : "(")
1377 . $dative . $Dcomma
1378 . " "
1379 6 ▶ . (defined $_[0]{A} ? join ", ", map({ $_->translate($_[0]{V}) } @{$_[0]{A}}) : "")
Branch: 3 branches
BranchTrueFalseTotal
$noparen ? : 0 6 6
defined $_[0]{'A'} ? : 6 0 6
$noparen ? : 0 6 6
1380 . ($noparen ? "" : ")") ;
1381 }
1382 ▶ elsif ($prefix && $dative) {
Condition0%0/3
$prefix and $dative
!ll&&!rl&&r
000
MC/DC0%0/2
$prefix and $dative
$prefix $dative
Truth table0%0/3
A and B
A= $prefixB= $dative
ABresult
0X0
100
111
1383 0 $result = " $verb $dative ";
1384 }
1385 elsif ($prefix) {
1386 0 $result = " $verb (" . $_[0]{A}[0]->translate . ")";
1387 }
1388 elsif ( $verb eq '=' ) {
1389 $result = " "
1390 . $dative
1391 . " $verb "
1392 0 . ( @{$_[0]{A}} > 1
1393 0 ? "(" . join(",", map($_->translate, @{$_[0]{A}})) . ")"
1394 0 ▶ : $_[0]{A}[0]->translate
Branch: 1 branch
BranchTrueFalseTotal
@{$_[0]{'A'};} > 1 ? : 0 0 0
1395 );
1396 }
1397 else
1398 {
1399 0 ▶ my $Acount = @{$_[0]{A}||[]};
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"A"} or [] 0 0 0
1400 0 ▶ my $neg = $verb =~ s/^!(<=>|cmp)/$1/ ? "!" : "";
Branch: 1 branch
BranchTrueFalseTotal
$verb =~ s/^!(<=>|cmp)/$1/ ? : 0 0 0
1401 $result = " $neg("
1402 . ( $dative ? $dative
1403 0 ▶ : $Acount-- ? shift(@{$_[0]{A}})->translate
Branch: 1 branch
BranchTrueFalseTotal
$Acount ? : 0 0 0
1404 : "")
1405 . " $verb "
1406 0 ▶ . ( $Acount ? $_[0]{A}[0]->translate : "")
Branch: 2 branches
BranchTrueFalseTotal
$dative ? : 0 0 0
$Acount-- ? : 0 0 0
1407 . ")";
1408 }
1409 6 ▶ if ($_[0]->{G}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]{"G"}) 0 6 6
1410 0 my $perl = pop(@{$_[0]->{G}})->{perl}; # LAST GENITIVE IS THE VARIABLE
1411 0 $perl =~ s/^([\%\@])/\$/;
1412 0 my $type = $1;
1413 0 ▶ while (my $next = pop @{$_[0]->{G}}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $next = pop @{$_[0]{"G"};}) 0 0 0
1414 0 $perl .= $lb{$type} . $next->translate . $rb{$type};
1415 }
1416 0 $result = $perl . $lb{$type} . $result . $rb{$type};
1417 }
1418 6 ▶ return '\\'x($_[0]{R}||0) . $result;
Condition50%1/2
$_[0]{'R'} || 0
l!l
06
MC/DC0%0/1
$_[0]{'R'} || 0
$_[0]{'R'}
Truth table50%1/2
A
A= $_[0]{'R'}
Aresult
11
00
1419 }
1420  
1421 sub BLOCK::translate {
1422 return "{"
1423 4 ▶ . join(";\n", map {$_->translate} @{$_[0]})
Subroutine translate: called CC=1 SCAR=0.0
1424 . "}" ;
1425 }
1426  
1427 sub CONNECTIVE::translate {
1428 0 ▶ return $_[0]{L}->translate . " $_[0]{perl} " . $_[0]{R}->translate;
Subroutine translate: not called CC=1 SCAR=6.9
1429 }
1430  
1431 sub Separator::translate {
1432 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1433 }
1434  
1435 sub SUBNAME::translate {
1436 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1437 }
1438  
1439 sub SUBNAME_OA::translate {
1440 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1441 }
1442  
1443 sub SUBNAME_A::translate {
1444 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1445 }
1446  
1447 sub SUBNAME_D::translate {
1448 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1449 }
1450  
1451 sub SUBNAME_AD::translate {
1452 2 ▶ return $_[0]{perl};
Subroutine translate: called CC=1 SCAR=0.0
1453 }
1454  
1455 sub SUBNAME_AB::translate {
1456 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1457 }
1458  
1459 sub SUBNAME_ACCUSATIVE::translate {
1460 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1461 }
1462  
1463 sub SUBNAME_A_ACCUSATIVE::translate {
1464 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1465 }
1466  
1467 sub SUBNAME_D_ACCUSATIVE::translate {
1468 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1469 }
1470  
1471 sub SUBNAME_AD_ACCUSATIVE::translate {
1472 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1473 }
1474  
1475 sub SUBNAME_AB_ACCUSATIVE::translate {
1476 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1477 }
1478  
1479 sub SUBNAME_B_ACCUSATIVE::translate {
1480 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1481 }
1482  
1483 sub SUBNAME_DATIVE::translate {
1484 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1485 }
1486  
1487 sub SUBNAME_A_DATIVE::translate {
1488 2 ▶ return $_[0]{perl};
Subroutine translate: called CC=1 SCAR=0.0
1489 }
1490  
1491 sub SUBNAME_D_DATIVE::translate {
1492 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1493 }
1494  
1495 sub SUBNAME_AD_DATIVE::translate {
1496 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1497 }
1498  
1499 sub SUBNAME_AB_DATIVE::translate {
1500 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1501 }
1502  
1503 sub SUBNAME_B_DATIVE::translate {
1504 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1505 }
1506  
1507 sub DATIVE::translate {
1508 2 ▶ my ($self) = @_;
Subroutine translate: called CC=3 SCAR=17.8
1509 2 my $perl = $self->{perl};
1510 2 ▶ if ($self->{G}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"G"}) 0 2 2
1511 0 my $gen = pop(@{$self->{G}})->{perl}; # LAST GENITIVE IS THE VARIABLE
1512 0 $gen =~ s/^([\%\@])/\$/;
1513 0 my $type = $1;
1514 0 ▶ while (my $next = pop @{$self->{G}}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $next = pop @{$$self{"G"};}) 0 0 0
1515 0 $gen .= $lb{$type} . $next->translate . $rb{$type};
1516 }
1517 0 $perl = $gen . $lb{$type} . $perl . $rb{$type};
1518 }
1519 2 return $perl;
1520 }
1521  
1522 sub OWNER_D::translate {
1523 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1524 }
1525  
1526 sub ACCUSATIVE::translate {
1527 4 ▶ my ($self) = @_;
Subroutine translate: called CC=4 SCAR=21.7
1528 4 my $perl = $self->{perl};
1529 4 ▶ if ($self->{G}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"G"}) 0 4 4
1530 0 my $gen = pop(@{$self->{G}})->{perl}; # LAST GENITIVE IS THE VARIABLE
1531 0 $gen =~ s/^([\%\@])/\$/;
1532 0 my $type = $1;
1533 0 ▶ while (my $next = pop @{$self->{G}}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $next = pop @{$$self{"G"};}) 0 0 0
1534 0 $gen .= $lb{$type} . $next->translate . $rb{$type};
1535 }
1536 0 $perl = $gen . $lb{$type} . $perl . $rb{$type};
1537 }
1538 4 ▶ return '\\'x($_[0]{R}||0) . $perl;
Condition50%1/2
$_[0]{'R'} || 0
l!l
04
MC/DC0%0/1
$_[0]{'R'} || 0
$_[0]{'R'}
Truth table50%1/2
A
A= $_[0]{'R'}
Aresult
11
00
1539 }
1540  
1541 sub CONTROL::translate {
1542 return $_[0]{perl}
1543 . " (" . $_[0]{C}->translate . ") "
1544 . $_[0]{B}->translate
1545 0 ▶ . "\n";
Subroutine translate: not called CC=1 SCAR=6.9
1546 }
1547  
1548 sub FOR::translate {
1549 return $_[0]{perl}
1550 . " " . $_[0]{D}->translate
1551 . " (" . $_[0]{C}->translate . ") "
1552 . $_[0]{B}->translate
1553 2 ▶ . "\n";
Subroutine translate: called CC=1 SCAR=0.0
1554 }
1555  
1556 sub NUMERAL::translate {
1557 4 ▶ my ($self) = @_;
Subroutine translate: called CC=1 SCAR=0.0
1558 # if ($self->{G}) {
1559 # return $self->{G}->index($self->{perl});
1560 # }
1561 4 return $self->{perl};
1562 }
1563  
1564 sub ORDINAL::translate {
1565 2 ▶ my ($self) = @_;
Subroutine translate: called CC=3 SCAR=11.3
1566 2 ▶ return $self->{perl} unless $self->{G};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"G"} 0 2 2
1567 2 my $perl = pop(@{$self->{G}})->translate; # LAST GENITIVE IS THE VARIABLE
1568 2 $perl =~ s/^([\%\@])/\$/;
1569 2 my $type = $1;
1570 2 ▶ while (my $next = pop @{$self->{G}}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $next = pop @{$$self{"G"};}) 0 2 2
1571 0 $perl .= $lb{$type} . $next->translate . $rb{$type};
1572 }
1573 2 return $perl . $lb{$type} . $self->{perl} . $rb{$type};
1574 }
1575  
1576 2 *ORDINAL_DATIVE::translate = *ORDINAL::translate;
1577  
1578 sub DISJUNCTION::translate {
1579 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1580 }
1581  
1582 sub CONJUNCTION::translate {
1583 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1584 }
1585  
1586 sub Literal::translate {
1587 8 ▶ my ($self, $context) = @_;
Subroutine translate: called CC=9 SCAR=30.9
1588 8 my $perl;
1589 8 ▶ if ($context && $context->{raw} =~ /^inque/) {
Branch: 4 branches
BranchTrueFalseTotal
if ($context and $context->{'raw'} =~ /^inque/) { } 0 8 8
elsif ($self->{'lex'} eq 'GENITIVE') { } 0 8 8
elsif ($self->{'lex'} eq 'SUBNAME_A_GENITIVE') { } 0 8 8
elsif ($self->{'lex'} eq 'INFINITIVE') { } 2 6 8
Condition66%2/3
$context and $context->{"raw"} =~ /^inque/
!ll&&!rl&&r
620
MC/DC0%0/2
$context and $context->{"raw"} =~ /^inque/
$context $context->{"raw"} =~ /^inque/
Truth table66%2/3
A and B
A= $contextB= $context->{"raw"} =~ /^inque/
ABresult
0X0
100
111
1590 0 $perl = qq{'$_[0]{raw}'}
1591 }
1592 elsif ( $self->{lex} eq 'GENITIVE' ) {
1593 0 $perl = $self->GENITIVE::translate;
1594 }
1595 elsif ( $self->{lex} eq 'SUBNAME_A_GENITIVE' ) {
1596 0 $perl = $self->SUBNAME_A_GENITIVE::translate;
1597 }
1598 elsif ( $self->{lex} eq 'INFINITIVE' ) {
1599 2 $perl = "sub $_[0]{perl}\n" . $_[0]{B}->translate;
1600 }
1601 else {
1602 $perl = '\\'x($_[0]{R}||0) . $_[0]{perl}
1603 6 ▶ }
Condition50%1/2
$_[0]{'R'} || 0
l!l
06
MC/DC0%0/1
$_[0]{'R'} || 0
$_[0]{'R'}
Truth table50%1/2
A
A= $_[0]{'R'}
Aresult
11
00
1604 8 ▶ if ($self->{G}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"G"}) 0 8 8
1605 0 my $gen = pop(@{$self->{G}})->{perl}; # LAST GENITIVE IS THE VARIABLE
1606 0 $gen =~ s/^([\%\@])/\$/;
1607 0 my $type = $1;
1608 0 ▶ while (my $next = pop @{$self->{G}}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $next = pop @{$$self{"G"};}) 0 0 0
1609 0 $gen .= $lb{$type} . $next->translate . $rb{$type};
1610 }
1611 0 $perl = $gen . $lb{$type} . $perl . $rb{$type};
1612 }
1613 8 return $perl;
1614 }
1615  
1616 sub GENITIVE::translate {
1617 2 ▶ return $_[0]{perl};
Subroutine translate: called CC=1 SCAR=0.0
1618 };
1619  
1620 sub SUBNAME_A_GENITIVE::translate {
1621 0 ▶ return $_[0]{perl};
Subroutine translate: not called CC=1 SCAR=6.9
1622 };
1623  
1624 sub Name::translate {
1625 2 ▶ return qq{'$_[0]{raw}'}
Subroutine translate: called CC=1 SCAR=0.0
1626 }
1627  
1628 2 1;
1629  
1630 __END__
↑ Summary