line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geo::Parse::PolishFormat; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
34588
|
use 5.008008; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
45
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
40
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
3636
|
use Data::Dumper; |
|
1
|
|
|
|
|
16843
|
|
|
1
|
|
|
|
|
649
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
0
|
0
|
|
my $package = shift; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
my %options = @_; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$options {get_split_depth} ||= sub { |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
0
|
|
|
my ($name) = @_; |
20
|
|
|
|
|
|
|
|
21
|
0
|
0
|
|
|
|
|
return 2 if $name =~ /^Data/; |
22
|
0
|
0
|
|
|
|
|
return 1 if $name =~ /^Nod/; |
23
|
0
|
|
|
|
|
|
return 0; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
0
|
|
|
|
}; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
return bless (\%options, $package); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub parse { |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
0
|
0
|
|
my ($self, $fn, $callback) = @_; |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
|
open (F, $fn) or die "Can't read '$fn':$!\n"; |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
my $name; |
38
|
|
|
|
|
|
|
my @lines; |
39
|
0
|
|
|
|
|
|
my $attributes; |
40
|
0
|
|
|
|
|
|
my $collections; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
while (my $line = ) { |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
$line =~ s{[\n\r]}{}gsm; |
45
|
|
|
|
|
|
|
|
46
|
0
|
0
|
|
|
|
|
if ($line =~ /^\[END/) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
&$callback ({ |
49
|
|
|
|
|
|
|
name => $name, |
50
|
|
|
|
|
|
|
lines => \@lines, |
51
|
|
|
|
|
|
|
attributes => $attributes, |
52
|
|
|
|
|
|
|
collections => $collections, |
53
|
|
|
|
|
|
|
}); |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
undef $name; |
56
|
0
|
|
|
|
|
|
undef @lines; |
57
|
0
|
|
|
|
|
|
undef $attributes; |
58
|
0
|
|
|
|
|
|
undef $collections; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
elsif ($line =~ /^\[([\w\s]+)\]$/) { |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
$name = $1; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
next; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
elsif (!$name) { |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
next; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
else { |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
push @lines, $line; |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
my ($key, $value) = split /\=/, $line; |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
my $split_depth = &{$self -> {get_split_depth}} ($key); |
|
0
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
0
|
0
|
|
|
|
|
if ($split_depth == 1) { |
|
|
0
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
$value = [split /\,/, $value]; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
elsif ($split_depth == 2) { |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
$value =~ s{^\(}{}; |
89
|
0
|
|
|
|
|
|
$value =~ s{\)$}{}; |
90
|
0
|
|
|
|
|
|
$value = [map {[split /\,/, $_]} split /\)\,\(/, $value]; |
|
0
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
$attributes -> {$key} = $value; |
95
|
|
|
|
|
|
|
|
96
|
0
|
0
|
|
|
|
|
if ($key =~ /([A-Za-z_]+)(\d+)$/) { |
97
|
0
|
|
0
|
|
|
|
$collections -> {$1} ||= []; |
98
|
0
|
|
|
|
|
|
$collections -> {$1} -> [$2] = $value; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
close (F); |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
1; |
110
|
|
|
|
|
|
|
__END__ |