line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::ToPerl6::Transformer::FormatSpecialLiterals; |
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
64373
|
use 5.006001; |
|
17
|
|
|
|
|
64
|
|
4
|
17
|
|
|
17
|
|
75
|
use strict; |
|
17
|
|
|
|
|
21
|
|
|
17
|
|
|
|
|
410
|
|
5
|
17
|
|
|
17
|
|
69
|
use warnings; |
|
17
|
|
|
|
|
23
|
|
|
17
|
|
|
|
|
488
|
|
6
|
17
|
|
|
17
|
|
72
|
use Readonly; |
|
17
|
|
|
|
|
23
|
|
|
17
|
|
|
|
|
1055
|
|
7
|
|
|
|
|
|
|
|
8
|
17
|
|
|
17
|
|
85
|
use Perl::ToPerl6::Utils qw{ :characters :severities }; |
|
17
|
|
|
|
|
33
|
|
|
17
|
|
|
|
|
1393
|
|
9
|
|
|
|
|
|
|
|
10
|
17
|
|
|
17
|
|
4941
|
use base 'Perl::ToPerl6::Transformer'; |
|
17
|
|
|
|
|
31
|
|
|
17
|
|
|
|
|
8870
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Readonly::Scalar my $DESC => q{Transform '__END__' etc.}; |
17
|
|
|
|
|
|
|
Readonly::Scalar my $EXPL => q{__END__ and __DATA__ are now POD markers}; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my %map = ( |
22
|
|
|
|
|
|
|
'__END__' => '=finish', |
23
|
|
|
|
|
|
|
'__FILE__' => '$?FILE', |
24
|
|
|
|
|
|
|
'__LINE__' => '$?LINE', |
25
|
|
|
|
|
|
|
'__PACKAGE__' => '$?PACKAGE', |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
29
|
|
|
|
|
|
|
|
30
|
40
|
|
|
40
|
0
|
1425
|
sub supported_parameters { return () } |
31
|
29
|
|
|
29
|
1
|
127
|
sub default_severity { return $SEVERITY_HIGHEST } |
32
|
25
|
|
|
25
|
1
|
87
|
sub default_themes { return qw(core bugs) } |
33
|
|
|
|
|
|
|
sub applies_to { |
34
|
|
|
|
|
|
|
return sub { |
35
|
|
|
|
|
|
|
( $_[1]->isa('PPI::Token::Separator') or |
36
|
|
|
|
|
|
|
$_[1]->isa('PPI::Token::End') or |
37
|
|
|
|
|
|
|
$_[1]->isa('PPI::Token::Word') ) and |
38
|
61
|
100
|
33
|
61
|
|
1143
|
exists $map{$_[1]->content} |
|
|
|
66
|
|
|
|
|
39
|
|
|
|
|
|
|
} |
40
|
4
|
|
|
4
|
1
|
21
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub transform { |
45
|
0
|
|
|
0
|
0
|
|
my ($self, $elem, $doc) = @_; |
46
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
if ( $elem->isa('PPI::Token::Word') ) { |
|
|
0
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
my $new_content = $elem->content; |
49
|
0
|
|
|
|
|
|
$elem->set_content($map{$new_content}); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
elsif ( $elem->isa('PPI::Token::Separator') ) { |
52
|
0
|
|
|
|
|
|
my $new_content = $elem->content; |
53
|
0
|
|
|
|
|
|
$elem->set_content($map{$new_content}); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
return $self->transformation( $DESC, $EXPL, $elem ); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=pod |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 NAME |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Perl::ToPerl6::Transformer::FormatSpecialLiterals - Format __END__, __LINE__ &c |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 AFFILIATION |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
This Transformer is part of the core L<Perl::ToPerl6|Perl::ToPerl6> |
74
|
|
|
|
|
|
|
distribution. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 DESCRIPTION |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ is replaced with the POD marker '=finish', and you can read beyond this boundary with the filehandle C<$*FINISH>: |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ --> =finish |
82
|
|
|
|
|
|
|
__LINE__ --> $?LINE |
83
|
|
|
|
|
|
|
__FILE__ --> $?FILE |
84
|
|
|
|
|
|
|
__PACKAGE__ --> $?PACKAGE |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 CONFIGURATION |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This Transformer is not configurable except for the standard options. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 AUTHOR |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Jeffrey Goff <drforr@pobox.com> |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 COPYRIGHT |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Copyright (c) 2015 Jeffrey Goff |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
99
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
############################################################################## |
104
|
|
|
|
|
|
|
# Local Variables: |
105
|
|
|
|
|
|
|
# mode: cperl |
106
|
|
|
|
|
|
|
# cperl-indent-level: 4 |
107
|
|
|
|
|
|
|
# fill-column: 78 |
108
|
|
|
|
|
|
|
# indent-tabs-mode: nil |
109
|
|
|
|
|
|
|
# c-indentation-style: bsd |
110
|
|
|
|
|
|
|
# End: |
111
|
|
|
|
|
|
|
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : |