line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2003-2021 by [Mark Overmeer]. |
2
|
|
|
|
|
|
|
# For other contributors see ChangeLog. |
3
|
|
|
|
|
|
|
# See the manual pages for details on the licensing terms. |
4
|
|
|
|
|
|
|
# Pod stripped from pm file by OODoc 2.02. |
5
|
|
|
|
|
|
|
# This code is part of perl distribution OODoc. It is licensed under the |
6
|
|
|
|
|
|
|
# same terms as Perl itself: https://spdx.org/licenses/Artistic-2.0.html |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package OODoc::Text; |
9
|
1
|
|
|
1
|
|
8
|
use vars '$VERSION'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
50
|
|
10
|
|
|
|
|
|
|
$VERSION = '2.02'; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
5
|
use base 'OODoc::Object'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
387
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
15
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
5
|
use Log::Report 'oodoc'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
0
|
|
|
use overload '==' => sub {$_[0]->unique == $_[1]->unique} |
21
|
0
|
|
|
0
|
|
|
, '!=' => sub {$_[0]->unique != $_[1]->unique} |
22
|
0
|
|
|
0
|
|
|
, '""' => sub {$_[0]->name} |
23
|
0
|
|
|
0
|
|
|
, 'cmp' => sub {$_[0]->name cmp "$_[1]"} |
24
|
1
|
|
|
1
|
|
338
|
, 'bool' => sub {1}; |
|
1
|
|
|
0
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
|
0
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
#------------------------------------------- |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $unique = 1; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub init($) |
32
|
0
|
|
|
0
|
0
|
|
{ my ($self, $args) = @_; |
33
|
0
|
0
|
|
|
|
|
$self->SUPER::init($args) or return; |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
$self->{OT_name} = delete $args->{name}; |
36
|
|
|
|
|
|
|
|
37
|
0
|
0
|
|
|
|
|
my $nr = $self->{OT_linenr} = delete $args->{linenr} or panic; |
38
|
0
|
0
|
|
|
|
|
$self->{OT_type} = delete $args->{type} or panic; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
exists $args->{container} # may be explicit undef |
41
|
0
|
0
|
|
|
|
|
or panic "no text container specified for the {pkg} object" |
42
|
|
|
|
|
|
|
, pkg => ref $self; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# may be undef |
45
|
0
|
|
|
|
|
|
$self->{OT_container}= delete $args->{container}; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
0
|
|
|
|
$self->{OT_descr} = delete $args->{description} || ''; |
48
|
0
|
|
|
|
|
|
$self->{OT_examples} = []; |
49
|
0
|
|
|
|
|
|
$self->{OT_unique} = $unique++; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
$self; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
#------------------------------------------- |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
0
|
1
|
|
sub name() {shift->{OT_name}} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
0
|
1
|
|
sub type() {shift->{OT_type}} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub description() |
64
|
0
|
|
|
0
|
1
|
|
{ my $text = shift->{OT_descr}; |
65
|
0
|
|
|
|
|
|
my @lines = split /^/m, $text; |
66
|
0
|
|
0
|
|
|
|
shift @lines while @lines && $lines[ 0] =~ m/^\s*$/; |
67
|
0
|
|
0
|
|
|
|
pop @lines while @lines && $lines[-1] =~ m/^\s*$/; |
68
|
0
|
|
|
|
|
|
join '', @lines; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub container(;$) |
73
|
0
|
|
|
0
|
1
|
|
{ my $self = shift; |
74
|
0
|
0
|
|
|
|
|
@_ ? ($self->{OT_container} = shift) : $self->{OT_container}; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub manual(;$) |
79
|
0
|
|
|
0
|
1
|
|
{ my $self = shift; |
80
|
0
|
0
|
|
|
|
|
@_ ? $self->SUPER::manual(@_) |
81
|
|
|
|
|
|
|
: $self->container->manual; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
0
|
1
|
|
sub unique() {shift->{OT_unique}} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub where() |
89
|
0
|
|
|
0
|
1
|
|
{ my $self = shift; |
90
|
0
|
|
|
|
|
|
($self->manual->source, $self->{OT_linenr}); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
#------------------------------------------- |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
0
|
1
|
|
sub openDescription() { \shift->{OT_descr} } |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub findDescriptionObject() |
100
|
0
|
|
|
0
|
1
|
|
{ my $self = shift; |
101
|
0
|
0
|
|
|
|
|
return $self if length $self->description; |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
my @descr = map { $_->findDescriptionObject } $self->extends; |
|
0
|
|
|
|
|
|
|
104
|
0
|
0
|
|
|
|
|
wantarray ? @descr : $descr[0]; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub example($) |
109
|
0
|
|
|
0
|
1
|
|
{ my ($self, $example) = @_; |
110
|
0
|
|
|
|
|
|
push @{$self->{OT_examples}}, $example; |
|
0
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
$example; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
0
|
|
|
0
|
1
|
|
sub examples() { @{shift->{OT_examples}} } |
|
0
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
#------------------------------------------- |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
1; |