line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::ToPerl6::Transformer::CompoundStatements::FormatUntils; |
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
12110
|
use 5.006001; |
|
17
|
|
|
|
|
53
|
|
4
|
17
|
|
|
17
|
|
76
|
use strict; |
|
17
|
|
|
|
|
42
|
|
|
17
|
|
|
|
|
364
|
|
5
|
17
|
|
|
17
|
|
67
|
use warnings; |
|
17
|
|
|
|
|
23
|
|
|
17
|
|
|
|
|
422
|
|
6
|
17
|
|
|
17
|
|
70
|
use Readonly; |
|
17
|
|
|
|
|
26
|
|
|
17
|
|
|
|
|
901
|
|
7
|
|
|
|
|
|
|
|
8
|
17
|
|
|
17
|
|
84
|
use Perl::ToPerl6::Utils qw{ :characters :severities }; |
|
17
|
|
|
|
|
24
|
|
|
17
|
|
|
|
|
929
|
|
9
|
17
|
|
|
17
|
|
4733
|
use Perl::ToPerl6::Utils::PPI qw{ is_ppi_statement_compound }; |
|
17
|
|
|
|
|
28
|
|
|
17
|
|
|
|
|
940
|
|
10
|
|
|
|
|
|
|
|
11
|
17
|
|
|
17
|
|
94
|
use base 'Perl::ToPerl6::Transformer'; |
|
17
|
|
|
|
|
24
|
|
|
17
|
|
|
|
|
5168
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Readonly::Scalar my $DESC => q{Transform 'until()' to 'until ()'}; |
18
|
|
|
|
|
|
|
Readonly::Scalar my $EXPL => |
19
|
|
|
|
|
|
|
q{unless() needs whitespace in order to not be interpreted as a function call}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my %map = ( |
24
|
|
|
|
|
|
|
until => 1 |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
28
|
|
|
|
|
|
|
|
29
|
40
|
|
|
40
|
0
|
2020
|
sub supported_parameters { return () } |
30
|
29
|
|
|
29
|
1
|
111
|
sub default_severity { return $SEVERITY_HIGHEST } |
31
|
25
|
|
|
25
|
1
|
78
|
sub default_themes { return qw(core bugs) } |
32
|
|
|
|
|
|
|
sub applies_to { |
33
|
|
|
|
|
|
|
return sub { |
34
|
61
|
50
|
33
|
61
|
|
629
|
is_ppi_statement_compound($_[1], %map) and |
35
|
|
|
|
|
|
|
$_[1]->first_element->next_sibling and |
36
|
|
|
|
|
|
|
not $_[1]->first_element->next_sibling->isa('PPI::Token::Whitespace') |
37
|
|
|
|
|
|
|
} |
38
|
4
|
|
|
4
|
1
|
21
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub transform { |
43
|
0
|
|
|
0
|
0
|
|
my ($self, $elem, $doc) = @_; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
$elem->first_element->insert_after( |
46
|
|
|
|
|
|
|
PPI::Token::Whitespace->new(' ') |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
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::CompoundStatements::FormatUntils - Format until() |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 AFFILIATION |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This Transformer is part of the core L<Perl::ToPerl6|Perl::ToPerl6> |
68
|
|
|
|
|
|
|
distribution. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 DESCRIPTION |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
While Perl6 conditionals allow parentheses, they need whitespace between the bareword C<until> and the opening parenthesis to avoid being interpreted as a function call: |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
until(1) { } --> until (1) { } |
76
|
|
|
|
|
|
|
until (1) { } --> until (1) { } |
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 : |