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