| 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.0001'; |
|
4
|
15
|
|
|
15
|
|
17046
|
use 5.010; |
|
|
15
|
|
|
|
|
35
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
15
|
|
|
15
|
|
3547
|
use Class::Tiny::Antlers; |
|
|
15
|
|
|
|
|
32383
|
|
|
|
15
|
|
|
|
|
72
|
|
|
7
|
15
|
|
|
15
|
|
7541
|
use namespace::clean; |
|
|
15
|
|
|
|
|
146802
|
|
|
|
15
|
|
|
|
|
61
|
|
|
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
|
284186
|
|
|
284186
|
0
|
2282714
|
my $class = shift; |
|
27
|
284186
|
|
|
|
|
226962
|
my $attributes = {}; |
|
28
|
|
|
|
|
|
|
|
|
29
|
284186
|
50
|
|
|
|
530355
|
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
|
284186
|
|
|
|
|
462258
|
$attributes = { @_ }; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# split strings into a list of individual characters |
|
46
|
284186
|
100
|
66
|
|
|
982220
|
if (defined $attributes->{data} && !ref($attributes->{data})) { |
|
47
|
981
|
|
|
|
|
56952
|
$attributes->{data} = [split //, $attributes->{data}]; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
$attributes |
|
51
|
284186
|
|
|
|
|
380281
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub BUILD { |
|
54
|
284186
|
|
|
284186
|
0
|
3238927
|
my $self = shift; |
|
55
|
|
|
|
|
|
|
|
|
56
|
284186
|
50
|
|
|
|
4122322
|
die 'foo' unless ref($self->data) eq 'ARRAY' |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub at { |
|
60
|
281234
|
|
|
281234
|
1
|
211200
|
my $self = shift; |
|
61
|
281234
|
|
|
|
|
3621594
|
$self->data->[$self->position] |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub next { |
|
65
|
281262
|
|
|
281262
|
1
|
4506067
|
my $self = shift; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
ref($self)->new(data => $self->data, |
|
68
|
|
|
|
|
|
|
position => $self->position+1, |
|
69
|
281262
|
|
|
|
|
3616665
|
singletons => [ @{$self->singletons} ]) |
|
|
281262
|
|
|
|
|
7710970
|
|
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub add_singleton { |
|
73
|
1937
|
|
|
1937
|
1
|
2691
|
my ($self, $singleton) = (shift, shift); |
|
74
|
|
|
|
|
|
|
|
|
75
|
1937
|
|
|
|
|
1735
|
my @new_singletons = @{$self->singletons}; |
|
|
1937
|
|
|
|
|
27179
|
|
|
76
|
1937
|
|
|
|
|
8505
|
push @new_singletons, $singleton; |
|
77
|
1937
|
|
|
|
|
26670
|
ref($self)->new(data => $self->data, |
|
78
|
|
|
|
|
|
|
position => $self->position, |
|
79
|
|
|
|
|
|
|
singletons => [ @new_singletons ]) |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub get_singleton { |
|
83
|
1633
|
|
|
1633
|
1
|
2373
|
my ($self, $singleton_id) = (shift, shift); |
|
84
|
1633
|
|
|
|
|
28363
|
$self->singletons->[$singleton_id] |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub eof { |
|
88
|
279805
|
|
|
279805
|
1
|
203829
|
my $self = shift; |
|
89
|
279805
|
|
|
|
|
4108423
|
$self->position >= scalar @{$self->data}; |
|
|
279805
|
|
|
|
|
4115235
|
|
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__ |