line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Thrift::IDL::Comment; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Thrift::IDL::Comment |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Inherits from L |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
6
|
|
|
6
|
|
40
|
use strict; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
268
|
|
14
|
6
|
|
|
6
|
|
38
|
use warnings; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
233
|
|
15
|
6
|
|
|
6
|
|
38
|
use base qw(Thrift::IDL::Base); |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
3781
|
|
16
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw(value)); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 METHODS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head2 value |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Scalar accessor |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my %styles = ( |
27
|
|
|
|
|
|
|
c_multiline => qr{^/\* (.+?) \*/$}sx, |
28
|
|
|
|
|
|
|
c_single => qr{^\/\/+ (.*?)$}x, |
29
|
|
|
|
|
|
|
perl_single => qr{^[#]+ (.*?)$}x, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 style |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Returns 'c_multiline', 'c_single' or 'perl_single' depending on what form the comment takes |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub style { |
39
|
13
|
|
|
13
|
1
|
1259
|
my ($self) = @_; |
40
|
|
|
|
|
|
|
|
41
|
13
|
|
|
|
|
208
|
my $value = $self->value; |
42
|
13
|
|
|
|
|
275
|
keys %styles; # reset the each |
43
|
13
|
|
|
|
|
65
|
while (my ($style, $regex) = each %styles) { |
44
|
26
|
|
|
|
|
161
|
my ($escaped_value) = $value =~ $regex; |
45
|
26
|
100
|
|
|
|
93
|
next unless defined $escaped_value; |
46
|
13
|
|
|
|
|
75
|
return $style; |
47
|
|
|
|
|
|
|
} |
48
|
0
|
|
|
|
|
0
|
die "Unrecognized comment style for '$value'"; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 escaped_value |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Returns the content of the comment, based on the C |