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