line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::ToPerl6::Transformer::BasicTypes::Rationals::AddTrailingZero; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
755
|
use 5.006001; |
|
1
|
|
|
|
|
3
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
26
|
|
6
|
1
|
|
|
1
|
|
5
|
use Readonly; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
40
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use Perl::ToPerl6::Utils qw{ :severities }; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
46
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
117
|
use base 'Perl::ToPerl6::Transformer'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
276
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Readonly::Scalar my $DESC => q{Add trailing 0 after decimal point}; |
15
|
|
|
|
|
|
|
Readonly::Scalar my $EXPL => q{'1.' is no longer a valid floating-point number fomat}; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
2
|
0
|
9
|
sub supported_parameters { return () } |
20
|
1
|
|
|
1
|
1
|
4
|
sub default_necessity { return $NECESSITY_HIGHEST } |
21
|
0
|
|
|
0
|
1
|
|
sub default_themes { return qw( core ) } |
22
|
0
|
|
|
0
|
1
|
|
sub applies_to { return 'PPI::Token::Number::Float' } |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub transform { |
27
|
0
|
|
|
0
|
0
|
|
my ($self, $elem, $doc) = @_; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $old_content = $elem->content; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my ( $lhs, $rhs ) = split( /\./, $old_content ); |
32
|
0
|
0
|
0
|
|
|
|
return if $rhs and $rhs ne ''; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my $new_content = $lhs . '.0'; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
$elem->set_content( $new_content ); |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
return $self->transformation( $DESC, $EXPL, $elem ); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=pod |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 NAME |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Perl::ToPerl6::Transformer::BasicTypes::Rationals::AddTrailingZero - Add trailing zero where needed |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 AFFILIATION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This Transformer is part of the core L<Perl::ToPerl6|Perl::ToPerl6> |
57
|
|
|
|
|
|
|
distribution. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 DESCRIPTION |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Perl6 floating-point values have the format '1.0' where a trailing digit is required: |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1.0 --> 1.0 |
65
|
|
|
|
|
|
|
1. --> 1.0 |
66
|
|
|
|
|
|
|
.1 --> .1 |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Transforms floating-point numbers outside of comments, heredocs, strings and POD. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 CONFIGURATION |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
This Transformer is not configurable except for the standard options. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 AUTHOR |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Jeffrey Goff <drforr@pobox.com> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 COPYRIGHT |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Copyright (c) 2015 Jeffrey Goff |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
83
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
############################################################################## |
88
|
|
|
|
|
|
|
# Local Variables: |
89
|
|
|
|
|
|
|
# mode: cperl |
90
|
|
|
|
|
|
|
# cperl-indent-level: 4 |
91
|
|
|
|
|
|
|
# fill-column: 78 |
92
|
|
|
|
|
|
|
# indent-tabs-mode: nil |
93
|
|
|
|
|
|
|
# c-indentation-style: bsd |
94
|
|
|
|
|
|
|
# End: |
95
|
|
|
|
|
|
|
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : |