line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::ToPerl6::Transformer::Builtins::AddWhitespace; |
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
11110
|
use 5.006001; |
|
17
|
|
|
|
|
48
|
|
4
|
17
|
|
|
17
|
|
75
|
use strict; |
|
17
|
|
|
|
|
22
|
|
|
17
|
|
|
|
|
372
|
|
5
|
17
|
|
|
17
|
|
65
|
use warnings; |
|
17
|
|
|
|
|
26
|
|
|
17
|
|
|
|
|
396
|
|
6
|
17
|
|
|
17
|
|
58
|
use Readonly; |
|
17
|
|
|
|
|
23
|
|
|
17
|
|
|
|
|
849
|
|
7
|
|
|
|
|
|
|
|
8
|
17
|
|
|
17
|
|
87
|
use Perl::ToPerl6::Utils qw{ :characters :severities }; |
|
17
|
|
|
|
|
28
|
|
|
17
|
|
|
|
|
1063
|
|
9
|
17
|
|
|
17
|
|
4227
|
use Perl::ToPerl6::Utils::PPI qw{ is_ppi_token_word }; |
|
17
|
|
|
|
|
32
|
|
|
17
|
|
|
|
|
824
|
|
10
|
|
|
|
|
|
|
|
11
|
17
|
|
|
17
|
|
76
|
use base 'Perl::ToPerl6::Transformer'; |
|
17
|
|
|
|
|
26
|
|
|
17
|
|
|
|
|
4806
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Readonly::Scalar my $DESC => q{Transform my(...) to my (...)}; |
18
|
|
|
|
|
|
|
Readonly::Scalar my $EXPL => q{Transform my(...) to my (...)}; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my %map = ( |
23
|
|
|
|
|
|
|
my => 1, |
24
|
|
|
|
|
|
|
our => 1, |
25
|
|
|
|
|
|
|
print => 1, |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
40
|
|
|
40
|
0
|
1473
|
sub supported_parameters { return () } |
29
|
32
|
|
|
32
|
1
|
134
|
sub default_severity { return $SEVERITY_HIGHEST } |
30
|
25
|
|
|
25
|
1
|
85
|
sub default_themes { return qw(core bugs) } |
31
|
|
|
|
|
|
|
sub applies_to { |
32
|
|
|
|
|
|
|
return sub { |
33
|
61
|
|
|
61
|
|
846
|
is_ppi_token_word($_[1], %map) |
34
|
|
|
|
|
|
|
} |
35
|
4
|
|
|
4
|
1
|
17
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub transform { |
40
|
3
|
|
|
3
|
0
|
5
|
my ($self, $elem, $doc) = @_; |
41
|
|
|
|
|
|
|
|
42
|
3
|
50
|
33
|
|
|
16
|
if ( $elem->next_sibling and |
43
|
|
|
|
|
|
|
not $elem->next_sibling->isa('PPI::Token::Whitespace') ) { |
44
|
0
|
|
|
|
|
0
|
$elem->insert_after( |
45
|
|
|
|
|
|
|
PPI::Token::Whitespace->new(' ') |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
3
|
|
|
|
|
103
|
return $self->transformation( $DESC, $EXPL, $elem ); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=pod |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 NAME |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Perl::ToPerl6::Transformer::Buiiltins::AddWhitespace - Format my(), our(), print() |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 AFFILIATION |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This Transformer is part of the core L<Perl::ToPerl6|Perl::ToPerl6> distribution. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 DESCRIPTION |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Perl6 requires whitespace after C<my>, C<our>, C<print> etc. in order to not confuse these builtins with methods: |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my() --> my () |
75
|
|
|
|
|
|
|
our() --> our () |
76
|
|
|
|
|
|
|
print() --> print () |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 CONFIGURATION |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This Transformer is not configurable except for the standard options. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 AUTHOR |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Jeffrey Goff <drforr@pobox.com> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 COPYRIGHT |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Copyright (c) 2015 Jeffrey Goff |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
91
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
############################################################################## |
96
|
|
|
|
|
|
|
# Local Variables: |
97
|
|
|
|
|
|
|
# mode: cperl |
98
|
|
|
|
|
|
|
# cperl-indent-level: 4 |
99
|
|
|
|
|
|
|
# fill-column: 78 |
100
|
|
|
|
|
|
|
# indent-tabs-mode: nil |
101
|
|
|
|
|
|
|
# c-indentation-style: bsd |
102
|
|
|
|
|
|
|
# End: |
103
|
|
|
|
|
|
|
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : |