| 1 | package Data::Sah::Compiler::human::TH::int; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 8 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | #use Log::Any '$log'; | ||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 8 | ▶ | use Mo qw(build default); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 8 | ▶ | use Role::Tiny::With; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 8 | extends 'Data::Sah::Compiler::human::TH::num'; | |||||||||||||||||||||||||||||||||||||||||
| 12 | 8 | with 'Data::Sah::Type::int'; | |||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 8 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |||||||||||||||||||||||||||||||||||||||||
| 15 | 8 | our $DATE = '2024-02-16'; # DATE | |||||||||||||||||||||||||||||||||||||||||
| 16 | 8 | our $DIST = 'Data-Sah'; # DIST | |||||||||||||||||||||||||||||||||||||||||
| 17 | 8 | our $VERSION = '0.917'; # VERSION | |||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 688 | ▶ | sub name { "integer" } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 692 | ▶ | sub handle_type { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
handle_type: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 692 | my ($self, $cd) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 23 | 692 | my $c = $self->compiler; | |||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 692 | $c->add_ccl($cd, { | |||||||||||||||||||||||||||||||||||||||||
| 26 | type => 'noun', | ||||||||||||||||||||||||||||||||||||||||||
| 27 | fmt => ["integer", "integers"], | ||||||||||||||||||||||||||||||||||||||||||
| 28 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 73 | ▶ | sub clause_div_by { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clause_div_by: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 73 | my ($self, $cd) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 33 | 73 | my $c = $self->compiler; | |||||||||||||||||||||||||||||||||||||||||
| 34 | 73 | my $cv = $cd->{cl_value}; | |||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 73 | ▶ | if (!$cd->{cl_is_multi} && !$cd->{cl_is_expr} && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
not $cd->{"cl_is_multi"} || $cd->{"cl_is_expr"} and $cv == 2
$cd->{'cl_is_multi'} || $cd->{'cl_is_expr'}
MC/DC66%2/3
not $cd->{"cl_is_multi"} || $cd->{"cl_is_expr"} and $cv == 2
$cd->{'cl_is_multi'}
$cd->{'cl_is_expr'}
$cv == 2
Truth table75%3/4
not(A || B) and C
A= $cd->{'cl_is_multi'}B= $cd->{'cl_is_expr'}C= $cv == 2
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | $cv == 2) { | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 25 | $c->add_ccl($cd, { | |||||||||||||||||||||||||||||||||||||||||
| 39 | fmt => q[%(modal_verb)s be even], | ||||||||||||||||||||||||||||||||||||||||||
| 40 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 25 | return; | |||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 48 | $c->add_ccl($cd, { | |||||||||||||||||||||||||||||||||||||||||
| 45 | fmt => q[%(modal_verb)s be divisible by %s], | ||||||||||||||||||||||||||||||||||||||||||
| 46 | expr => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 47 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 6 | ▶ | sub clause_mod { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clause_mod: called CC=9 SCAR=29.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 6 | my ($self, $cd) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 52 | 6 | my $c = $self->compiler; | |||||||||||||||||||||||||||||||||||||||||
| 53 | 6 | my $cv = $cd->{cl_value}; | |||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 6 | ▶ | if (!$cd->{cl_is_multi} && !$cd->{cl_is_expr}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$cd->{"cl_is_multi"} or $cd->{"cl_is_expr"}
MC/DC0%0/2
$cd->{"cl_is_multi"} or $cd->{"cl_is_expr"}
$cd->{"cl_is_multi"}
$cd->{"cl_is_expr"}
Truth table33%1/3
A or B
A= $cd->{"cl_is_multi"}B= $cd->{"cl_is_expr"}
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 6 | ▶ | if ($cv->[0] == 2 && $cv->[1] == 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$cv->[0] == 2 and $cv->[1] == 0
MC/DC0%0/2
$cv->[0] == 2 and $cv->[1] == 0
$cv->[0] == 2
$cv->[1] == 0
Truth table33%1/3
A and B
A= $cv->[0] == 2B= $cv->[1] == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | $c->add_ccl($cd, { | |||||||||||||||||||||||||||||||||||||||||
| 58 | fmt => q[%(modal_verb)s be even], | ||||||||||||||||||||||||||||||||||||||||||
| 59 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 61 | ▶ | } elsif ($cv->[0] == 2 && $cv->[1] == 1) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$cv->[0] == 2 and $cv->[1] == 1
MC/DC0%0/2
$cv->[0] == 2 and $cv->[1] == 1
$cv->[0] == 2
$cv->[1] == 1
Truth table33%1/3
A and B
A= $cv->[0] == 2B= $cv->[1] == 1
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | $c->add_ccl($cd, { | |||||||||||||||||||||||||||||||||||||||||
| 63 | fmt => q[%(modal_verb)s be odd], | ||||||||||||||||||||||||||||||||||||||||||
| 64 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | 6 | my @ccls; | |||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | for my $cv ($cd->{cl_is_multi} ? @{ $cd->{cl_value} } : ($cd->{cl_value})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | 6 | push @ccls, { | |||||||||||||||||||||||||||||||||||||||||
| 72 | fmt => q[%(modal_verb)s leave a remainder of %2$s when divided by %1$s], | ||||||||||||||||||||||||||||||||||||||||||
| 73 | vals => $cv, | ||||||||||||||||||||||||||||||||||||||||||
| 74 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||
| 76 | 6 | $c->add_ccl($cd, @ccls); | |||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 8 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 80 | # ABSTRACT: human's type handler for type "int" | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | __END__ | ||||||||||||||||||||||||||||||||||||||||||