line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# This software is copyright (c) 2011 by Jeffrey Kegler |
2
|
|
|
|
|
|
|
# This is free software; you can redistribute it and/or modify it |
3
|
|
|
|
|
|
|
# under the same terms as the Perl 5 programming language system |
4
|
|
|
|
|
|
|
# itself. |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Marpa::HTML::Offset; |
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
189
|
use 5.010; |
|
6
|
|
|
|
|
21
|
|
|
6
|
|
|
|
|
238
|
|
9
|
6
|
|
|
6
|
|
32
|
use strict; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
175
|
|
10
|
6
|
|
|
6
|
|
30
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
174
|
|
11
|
6
|
|
|
6
|
|
30
|
use integer; |
|
6
|
|
|
|
|
31
|
|
|
6
|
|
|
|
|
34
|
|
12
|
|
|
|
|
|
|
|
13
|
6
|
|
|
6
|
|
131
|
use Carp; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
758
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub import { |
16
|
18
|
|
|
18
|
|
57
|
my ( $class, @fields ) = @_; |
17
|
18
|
|
|
|
|
40
|
my $pkg = caller; |
18
|
18
|
|
|
|
|
34
|
my $prefix = $pkg . q{::}; |
19
|
18
|
|
|
|
|
26
|
my $offset = -1; |
20
|
18
|
|
|
|
|
20
|
my $in_comment = 0; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
## no critic (TestingAndDebugging::ProhibitNoStrict) |
23
|
6
|
|
|
6
|
|
32
|
no strict 'refs'; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
2176
|
|
24
|
|
|
|
|
|
|
## use critic |
25
|
18
|
|
|
|
|
44
|
FIELD: for my $field (@fields) { |
26
|
|
|
|
|
|
|
|
27
|
120
|
50
|
|
|
|
262
|
if ($in_comment) { |
28
|
0
|
|
0
|
|
|
0
|
$in_comment = $field ne ':}' && $field ne '}'; |
29
|
0
|
|
|
|
|
0
|
next FIELD; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
PROCESS_OPTION: { |
33
|
120
|
100
|
|
|
|
123
|
last PROCESS_OPTION if $field !~ /\A [{:] /xms; |
|
120
|
|
|
|
|
400
|
|
34
|
18
|
50
|
|
|
|
79
|
if ( $field =~ / \A [:] package [=] (.*) /xms ) { |
35
|
18
|
|
|
|
|
40
|
$prefix = $1 . q{::}; |
36
|
18
|
|
|
|
|
42
|
next FIELD; |
37
|
|
|
|
|
|
|
} |
38
|
0
|
0
|
|
|
|
0
|
if ( $field =~ / \A [:]? [{] /xms ) { |
39
|
0
|
|
|
|
|
0
|
$in_comment++; |
40
|
0
|
|
|
|
|
0
|
next FIELD; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} ## end PROCESS_OPTION: |
43
|
|
|
|
|
|
|
|
44
|
102
|
100
|
|
|
|
234
|
if ( $field !~ s/\A=//xms ) { |
45
|
90
|
|
|
|
|
98
|
$offset++; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
102
|
50
|
|
|
|
214
|
if ( $field =~ / \A ( [^=]* ) = ( [0-9+-]* ) \z/xms ) { |
49
|
0
|
|
|
|
|
0
|
$field = $1; |
50
|
0
|
|
|
|
|
0
|
$offset = $2 + 0; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
102
|
50
|
|
|
|
213
|
Carp::croak("Unacceptable field name: $field") |
54
|
|
|
|
|
|
|
if $field =~ /[^A-Z0-9_]/xms; |
55
|
102
|
|
|
|
|
170
|
my $field_name = $prefix . $field; |
56
|
102
|
|
|
0
|
|
614
|
*{$field_name} = sub () {$offset}; |
|
102
|
|
|
|
|
630
|
|
|
0
|
|
|
|
|
0
|
|
57
|
|
|
|
|
|
|
} ## end for my $field (@fields) |
58
|
18
|
|
|
|
|
788
|
return 1; |
59
|
|
|
|
|
|
|
} ## end sub import |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |