| 1 | package Data::Sah::Compiler::human::TH::float; | ||||||||||
| 2 | |||||||||||
| 3 | 5 | ▶ | use 5.010; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 5 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 5 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | #use Log::Any '$log'; | ||||||||||
| 7 | |||||||||||
| 8 | 5 | ▶ | use Mo qw(build default); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 5 | ▶ | use Role::Tiny::With; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 5 | extends 'Data::Sah::Compiler::human::TH'; | |||||||||
| 12 | 5 | with 'Data::Sah::Compiler::human::TH::Comparable'; | |||||||||
| 13 | 5 | with 'Data::Sah::Compiler::human::TH::Sortable'; | |||||||||
| 14 | 5 | with 'Data::Sah::Type::float'; | |||||||||
| 15 | |||||||||||
| 16 | 5 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |||||||||
| 17 | 5 | our $DATE = '2024-02-16'; # DATE | |||||||||
| 18 | 5 | our $DIST = 'Data-Sah'; # DIST | |||||||||
| 19 | 5 | our $VERSION = '0.917'; # VERSION | |||||||||
| 20 | |||||||||||
| 21 | 666 | ▶ | sub name { "decimal number" } | ||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 22 | |||||||||||
| 23 | 667 | ▶ | sub handle_type { | ||||||||
|
Subroutine
handle_type: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 24 | 667 | my ($self, $cd) = @_; | |||||||||
| 25 | 667 | my $c = $self->compiler; | |||||||||
| 26 | |||||||||||
| 27 | 667 | $c->add_ccl($cd, { | |||||||||
| 28 | type=>'noun', | ||||||||||
| 29 | fmt => ["decimal number", "decimal numbers"], | ||||||||||
| 30 | }); | ||||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 19 | ▶ | sub clause_is_nan { | ||||||||
|
Subroutine
clause_is_nan: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||
| 34 | 19 | my ($self, $cd) = @_; | |||||||||
| 35 | 19 | my $c = $self->compiler; | |||||||||
| 36 | |||||||||||
| 37 | 19 | my $cv = $cd->{cl_value}; | |||||||||
| 38 | 19 | ▶ | if ($cd->{cl_is_expr}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 0 | $c->add_ccl($cd, {}); | |||||||||
| 40 | } else { | ||||||||||
| 41 | 19 | ▶ | $c->add_ccl($cd, { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | fmt => $cv ? | ||||||||||
| 43 | q[%(modal_verb)s be a NaN] : | ||||||||||
| 44 | q[%(modal_verb_neg)s be a NaN], | ||||||||||
| 45 | }); | ||||||||||
| 46 | } | ||||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | 28 | ▶ | sub clause_is_inf { | ||||||||
|
Subroutine
clause_is_inf: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||
| 50 | 28 | my ($self, $cd) = @_; | |||||||||
| 51 | 28 | my $c = $self->compiler; | |||||||||
| 52 | |||||||||||
| 53 | 28 | my $cv = $cd->{cl_value}; | |||||||||
| 54 | 28 | ▶ | if ($cd->{cl_is_expr}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 55 | 0 | $c->add_ccl($cd, {}); | |||||||||
| 56 | } else { | ||||||||||
| 57 | 28 | ▶ | $c->add_ccl($cd, { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | fmt => $cv ? | ||||||||||
| 59 | q[%(modal_verb)s an infinity] : | ||||||||||
| 60 | q[%(modal_verb_neg)s an infinity], | ||||||||||
| 61 | }); | ||||||||||
| 62 | } | ||||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | 28 | ▶ | sub clause_is_pos_inf { | ||||||||
|
Subroutine
clause_is_pos_inf: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||
| 66 | 28 | my ($self, $cd) = @_; | |||||||||
| 67 | 28 | my $c = $self->compiler; | |||||||||
| 68 | |||||||||||
| 69 | 28 | my $cv = $cd->{cl_value}; | |||||||||
| 70 | 28 | ▶ | if ($cd->{cl_is_expr}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 71 | 0 | $c->add_ccl($cd, {}); | |||||||||
| 72 | } else { | ||||||||||
| 73 | 28 | ▶ | $c->add_ccl($cd, { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 74 | fmt => $cv ? | ||||||||||
| 75 | q[%(modal_verb)s a positive infinity] : | ||||||||||
| 76 | q[%(modal_verb_neg)s a positive infinity], | ||||||||||
| 77 | }); | ||||||||||
| 78 | } | ||||||||||
| 79 | } | ||||||||||
| 80 | |||||||||||
| 81 | 28 | ▶ | sub clause_is_neg_inf { | ||||||||
|
Subroutine
clause_is_neg_inf: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||
| 82 | 28 | my ($self, $cd) = @_; | |||||||||
| 83 | 28 | my $c = $self->compiler; | |||||||||
| 84 | |||||||||||
| 85 | 28 | my $cv = $cd->{cl_value}; | |||||||||
| 86 | 28 | ▶ | if ($cd->{cl_is_expr}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 87 | 0 | $c->add_ccl($cd, {}); | |||||||||
| 88 | } else { | ||||||||||
| 89 | 28 | ▶ | $c->add_ccl($cd, { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 90 | fmt => $cv ? | ||||||||||
| 91 | q[%(modal_verb)s a negative infinity] : | ||||||||||
| 92 | q[%(modal_verb_neg)s a negative infinity], | ||||||||||
| 93 | }); | ||||||||||
| 94 | } | ||||||||||
| 95 | } | ||||||||||
| 96 | |||||||||||
| 97 | 5 | 1; | |||||||||
| 98 | # ABSTRACT: human's type handler for type "num" | ||||||||||
| 99 | |||||||||||
| 100 | __END__ | ||||||||||