line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::ToPerl6::Transformer::BasicTypes::Strings::AddWhitespace; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
812
|
use 5.006001; |
|
1
|
|
|
|
|
3
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
6
|
1
|
|
|
1
|
|
5
|
use Readonly; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use Perl::ToPerl6::Utils qw{ :severities }; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
120
|
use base 'Perl::ToPerl6::Transformer'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
302
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Readonly::Scalar my $DESC => q{Rewrite interpolated strings}; |
15
|
|
|
|
|
|
|
Readonly::Scalar my $EXPL => q{Rewrite interpolated strings}; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
2
|
0
|
10
|
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
|
|
|
|
|
|
|
sub applies_to { |
23
|
|
|
|
|
|
|
return sub { |
24
|
|
|
|
|
|
|
$_[1]->isa('PPI::Token::Quote') and |
25
|
|
|
|
|
|
|
$_[1]->{operator} and |
26
|
0
|
0
|
0
|
0
|
|
|
$_[1]->{operator} =~ / ^ q /x |
27
|
|
|
|
|
|
|
} |
28
|
0
|
|
|
0
|
1
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub transform { |
33
|
0
|
|
|
0
|
0
|
|
my ($self, $elem, $doc) = @_; |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
my $new_content = $elem->content; |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
$new_content =~ s{ ^ (q?q)[(] }{$1 (}x; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
$elem->set_content( $new_content ); |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
return $self->transformation( $DESC, $EXPL, $elem ); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=pod |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 NAME |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Perl::ToPerl6::Transformer::BasicTypes::Strings::AddWhitespace - Add whitespace between q/qq and () |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 AFFILIATION |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
This Transformer is part of the core L<Perl::ToPerl6|Perl::ToPerl6> |
60
|
|
|
|
|
|
|
distribution. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 DESCRIPTION |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Perl6 q() and qq() delimiters require whitespace if you're using round braces, |
66
|
|
|
|
|
|
|
otherwise they get confused with a q() or qq() function: |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
q(Hello world) --> q (Hello world) |
69
|
|
|
|
|
|
|
q[Hello world] --> q[Hello world] |
70
|
|
|
|
|
|
|
qq (Hello world) --> q (Hello world) |
71
|
|
|
|
|
|
|
qq[Hello world] --> qq[Hello world] |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Transforms only interpolated strings outside of comments, heredocs and POD. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 CONFIGURATION |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This Transformer is not configurable except for the standard options. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 AUTHOR |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Jeffrey Goff <drforr@pobox.com> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 COPYRIGHT |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Copyright (c) 2015 Jeffrey Goff |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
88
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
############################################################################## |
93
|
|
|
|
|
|
|
# Local Variables: |
94
|
|
|
|
|
|
|
# mode: cperl |
95
|
|
|
|
|
|
|
# cperl-indent-level: 4 |
96
|
|
|
|
|
|
|
# fill-column: 78 |
97
|
|
|
|
|
|
|
# indent-tabs-mode: nil |
98
|
|
|
|
|
|
|
# c-indentation-style: bsd |
99
|
|
|
|
|
|
|
# End: |
100
|
|
|
|
|
|
|
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : |