| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Statistics::R::IO::ParserState; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: Current state of the IO parser |
|
3
|
|
|
|
|
|
|
$Statistics::R::IO::ParserState::VERSION = '1.0'; |
|
4
|
13
|
|
|
13
|
|
20877
|
use 5.010; |
|
|
13
|
|
|
|
|
30
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
13
|
|
|
13
|
|
3792
|
use Class::Tiny::Antlers; |
|
|
13
|
|
|
|
|
35144
|
|
|
|
13
|
|
|
|
|
76
|
|
|
7
|
13
|
|
|
13
|
|
6704
|
use namespace::clean; |
|
|
13
|
|
|
|
|
129917
|
|
|
|
13
|
|
|
|
|
38
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has data => ( |
|
10
|
|
|
|
|
|
|
is => 'ro', |
|
11
|
|
|
|
|
|
|
default => sub { [] }, |
|
12
|
|
|
|
|
|
|
); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has position => ( |
|
15
|
|
|
|
|
|
|
is => 'ro', |
|
16
|
|
|
|
|
|
|
default => sub { 0 }, |
|
17
|
|
|
|
|
|
|
); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has singletons => ( |
|
20
|
|
|
|
|
|
|
is => 'ro', |
|
21
|
|
|
|
|
|
|
default => sub { [] }, |
|
22
|
|
|
|
|
|
|
); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub BUILDARGS { |
|
26
|
117714
|
|
|
117714
|
0
|
1123858
|
my $class = shift; |
|
27
|
117714
|
|
|
|
|
100165
|
my $attributes = {}; |
|
28
|
|
|
|
|
|
|
|
|
29
|
117714
|
50
|
|
|
|
217887
|
if ( scalar @_ == 1) { |
|
|
|
50
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
0
|
if ( ref $_[0] eq 'HASH' ) { |
|
31
|
0
|
|
|
|
|
0
|
$attributes = $_[0] |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
else { |
|
34
|
0
|
|
|
|
|
0
|
$attributes->{name} = $_[0] |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
elsif ( @_ % 2 ) { |
|
38
|
0
|
|
|
|
|
0
|
die "The new() method for $class expects a hash reference or a key/value list." |
|
39
|
|
|
|
|
|
|
. " You passed an odd number of arguments\n"; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
else { |
|
42
|
117714
|
|
|
|
|
188280
|
$attributes = { @_ }; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# split strings into a list of individual characters |
|
46
|
117714
|
100
|
66
|
|
|
416380
|
if (defined $attributes->{data} && !ref($attributes->{data})) { |
|
47
|
515
|
|
|
|
|
25066
|
$attributes->{data} = [split //, $attributes->{data}]; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
$attributes |
|
51
|
117714
|
|
|
|
|
166492
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub BUILD { |
|
54
|
117714
|
|
|
117714
|
0
|
1378720
|
my $self = shift; |
|
55
|
|
|
|
|
|
|
|
|
56
|
117714
|
50
|
|
|
|
1736906
|
die 'foo' unless ref($self->data) eq 'ARRAY' |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub at { |
|
60
|
116434
|
|
|
116434
|
1
|
89667
|
my $self = shift; |
|
61
|
116434
|
|
|
|
|
1513425
|
$self->data->[$self->position] |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub next { |
|
65
|
116462
|
|
|
116462
|
1
|
1870282
|
my $self = shift; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
ref($self)->new(data => $self->data, |
|
68
|
|
|
|
|
|
|
position => $self->position+1, |
|
69
|
116462
|
|
|
|
|
1534510
|
singletons => [ @{$self->singletons} ]) |
|
|
116462
|
|
|
|
|
3252994
|
|
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub add_singleton { |
|
73
|
731
|
|
|
731
|
1
|
1722
|
my ($self, $singleton) = (shift, shift); |
|
74
|
|
|
|
|
|
|
|
|
75
|
731
|
|
|
|
|
779
|
my @new_singletons = @{$self->singletons}; |
|
|
731
|
|
|
|
|
10598
|
|
|
76
|
731
|
|
|
|
|
3455
|
push @new_singletons, $singleton; |
|
77
|
731
|
|
|
|
|
10702
|
ref($self)->new(data => $self->data, |
|
78
|
|
|
|
|
|
|
position => $self->position, |
|
79
|
|
|
|
|
|
|
singletons => [ @new_singletons ]) |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub get_singleton { |
|
83
|
579
|
|
|
579
|
1
|
2196
|
my ($self, $singleton_id) = (shift, shift); |
|
84
|
579
|
|
|
|
|
10084
|
$self->singletons->[$singleton_id] |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub eof { |
|
88
|
114073
|
|
|
114073
|
1
|
100454
|
my $self = shift; |
|
89
|
114073
|
|
|
|
|
1726860
|
$self->position >= scalar @{$self->data}; |
|
|
114073
|
|
|
|
|
1717345
|
|
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__ |