| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# Copyright 2009, 2010, 2011 Kevin Ryde |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# This file is part of Pod-MinimumVersion. |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# Pod-MinimumVersion is free software; you can redistribute it and/or modify |
|
6
|
|
|
|
|
|
|
# it under the terms of the GNU General Public License as published by the |
|
7
|
|
|
|
|
|
|
# Free Software Foundation; either version 3, or (at your option) any later |
|
8
|
|
|
|
|
|
|
# version. |
|
9
|
|
|
|
|
|
|
# |
|
10
|
|
|
|
|
|
|
# Pod-MinimumVersion is distributed in the hope that it will be useful, but |
|
11
|
|
|
|
|
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
|
12
|
|
|
|
|
|
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13
|
|
|
|
|
|
|
# for more details. |
|
14
|
|
|
|
|
|
|
# |
|
15
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License along |
|
16
|
|
|
|
|
|
|
# with Pod-MinimumVersion. If not, see . |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
package Pod::MinimumVersion::Parser; |
|
20
|
3
|
|
|
3
|
|
828
|
use 5.004; |
|
|
3
|
|
|
|
|
9
|
|
|
|
3
|
|
|
|
|
132
|
|
|
21
|
3
|
|
|
3
|
|
18
|
use strict; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
131
|
|
|
22
|
3
|
|
|
3
|
|
15
|
use vars '$VERSION', '@ISA'; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
176
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
3
|
|
|
3
|
|
16
|
use Pod::Parser; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
1762
|
|
|
25
|
|
|
|
|
|
|
@ISA = ('Pod::Parser'); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
$VERSION = 50; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# uncomment this to run the ### lines |
|
30
|
|
|
|
|
|
|
#use Smart::Comments; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub new { |
|
33
|
49
|
|
|
49
|
0
|
1203
|
my $class = shift; |
|
34
|
49
|
|
|
|
|
824
|
my $self = $class->SUPER::new(@_); |
|
35
|
49
|
|
|
|
|
306
|
$self->errorsub ('error_handler'); # method name |
|
36
|
49
|
|
|
|
|
135
|
return $self; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
sub error_handler { |
|
39
|
1
|
|
|
1
|
0
|
3
|
my ($self, $errmsg) = @_; |
|
40
|
|
|
|
|
|
|
### PMV error_handler() |
|
41
|
1
|
|
|
|
|
15
|
return 1; # error handled |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# sub begin_input { |
|
45
|
|
|
|
|
|
|
# print "begin_input\n"; |
|
46
|
|
|
|
|
|
|
# } |
|
47
|
|
|
|
|
|
|
# sub end_input { |
|
48
|
|
|
|
|
|
|
# print "end_input\n"; |
|
49
|
|
|
|
|
|
|
# } |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub parse_from_string { |
|
52
|
48
|
|
|
48
|
0
|
82
|
my ($self, $str) = @_; |
|
53
|
|
|
|
|
|
|
### PMV parse_from_string() |
|
54
|
|
|
|
|
|
|
|
|
55
|
48
|
|
|
|
|
1855
|
require IO::String; |
|
56
|
48
|
|
|
|
|
9762
|
my $fh = IO::String->new ($str); |
|
57
|
48
|
|
|
|
|
1710
|
$self->{_INFILE} = "(string)"; |
|
58
|
48
|
|
|
|
|
3385
|
return $self->parse_from_filehandle ($fh); |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my %command_does_not_interpolate = (for => 1, # free form text |
|
62
|
|
|
|
|
|
|
begin => 1, # formatname not text |
|
63
|
|
|
|
|
|
|
end => 1, |
|
64
|
|
|
|
|
|
|
pod => 1, # text ignored |
|
65
|
|
|
|
|
|
|
cut => 1, # text ignored |
|
66
|
|
|
|
|
|
|
encoding => 1, # encoding name not text |
|
67
|
|
|
|
|
|
|
); |
|
68
|
|
|
|
|
|
|
sub command { |
|
69
|
47
|
|
|
47
|
0
|
4137
|
my ($self, $command, $text, $linenum, $paraobj) = @_; |
|
70
|
|
|
|
|
|
|
### PMV command() |
|
71
|
|
|
|
|
|
|
### $command |
|
72
|
|
|
|
|
|
|
### $text |
|
73
|
|
|
|
|
|
|
### $linenum |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# If =foo command at EOF with no more chars, including no trailing |
|
76
|
|
|
|
|
|
|
# newline, then $text is undef (circa Pod::Parser 1.37 at least). |
|
77
|
|
|
|
|
|
|
# |
|
78
|
47
|
50
|
|
|
|
105
|
if (defined $text) { |
|
79
|
47
|
100
|
100
|
|
|
129
|
if ($command eq 'for' |
|
80
|
|
|
|
|
|
|
&& $text =~ /^Pod::MinimumVersion\s+use\s+(v?[0-9._]+)/) { |
|
81
|
2
|
|
|
|
|
21
|
$self->{'pmv'}->{'for_version'} = version->new($1); |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
47
|
|
|
|
|
59
|
foreach my $func (@{$self->{'checks'}->{'command'}}) { |
|
|
47
|
|
|
|
|
127
|
|
|
85
|
116
|
|
|
|
|
644
|
$func->($self->{'pmv'}, $command, $text, $paraobj); |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
47
|
100
|
|
|
|
141
|
unless ($command_does_not_interpolate{$command}) { |
|
89
|
14
|
|
|
|
|
676
|
$self->interpolate ($text, $linenum); |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
} |
|
92
|
47
|
|
|
|
|
782
|
return ''; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub verbatim { |
|
96
|
|
|
|
|
|
|
### PMV verbatim() |
|
97
|
0
|
|
|
0
|
0
|
0
|
return ''; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub textblock { |
|
101
|
27
|
|
|
27
|
0
|
1610
|
my ($self, $text, $linenum, $paraobj) = @_; |
|
102
|
|
|
|
|
|
|
### PMV textblock() |
|
103
|
|
|
|
|
|
|
### $text |
|
104
|
27
|
|
|
|
|
5253
|
return $self->interpolate ($text, $linenum); |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub interior_sequence { |
|
108
|
35
|
|
|
35
|
0
|
68
|
my ($self, $command, $arg, $seq_obj) = @_; |
|
109
|
|
|
|
|
|
|
### interior |
|
110
|
|
|
|
|
|
|
### $command |
|
111
|
|
|
|
|
|
|
### $arg |
|
112
|
|
|
|
|
|
|
### $seq_obj |
|
113
|
|
|
|
|
|
|
### raw_text: $seq_obj->raw_text |
|
114
|
|
|
|
|
|
|
### left: $seq_obj->left_delimiter |
|
115
|
|
|
|
|
|
|
### nested: do { my $outer = $seq_obj->nested; $outer && $outer->cmd_name } |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
# J<> from Pod::MultiLang -- doubled C<<>> or L<|display> are allowed |
|
118
|
|
|
|
|
|
|
# ENHANCE-ME: might prefer to make parse_tree() not descend into J<> at |
|
119
|
|
|
|
|
|
|
# all, but it doesn't seem setup for that |
|
120
|
35
|
|
|
|
|
35
|
my $outer; |
|
121
|
35
|
100
|
66
|
|
|
275
|
if ($command eq 'J' |
|
|
|
|
66
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|| (($outer = $seq_obj->nested) && $outer->cmd_name eq 'J')) { |
|
123
|
1
|
|
|
|
|
82
|
return ''; |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
|
|
126
|
34
|
|
|
|
|
44
|
foreach my $func (@{$self->{'checks'}->{'interior_sequence'}}) { |
|
|
34
|
|
|
|
|
91
|
|
|
127
|
147
|
|
|
|
|
557
|
$func->($self->{'pmv'}, $command, $arg, $seq_obj); |
|
128
|
|
|
|
|
|
|
} |
|
129
|
34
|
|
|
|
|
3227
|
return ''; |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
1; |
|
133
|
|
|
|
|
|
|
__END__ |