line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Language::P::Toy::Value::ScratchPad; |
2
|
|
|
|
|
|
|
|
3
|
19
|
|
|
19
|
|
3500
|
use strict; |
|
19
|
|
|
|
|
44
|
|
|
19
|
|
|
|
|
873
|
|
4
|
19
|
|
|
19
|
|
115
|
use warnings; |
|
19
|
|
|
|
|
37
|
|
|
19
|
|
|
|
|
758
|
|
5
|
19
|
|
|
19
|
|
107
|
use base qw(Language::P::Toy::Value::Any); |
|
19
|
|
|
|
|
40
|
|
|
19
|
|
|
|
|
2205
|
|
6
|
|
|
|
|
|
|
|
7
|
19
|
|
|
19
|
|
112
|
use Language::P::Toy::Value::StringNumber; |
|
19
|
|
|
|
|
41
|
|
|
19
|
|
|
|
|
157
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors( qw(outer names values clear) ); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
67
|
|
|
67
|
1
|
306
|
my( $class, $args ) = @_; |
13
|
67
|
|
|
|
|
424
|
my $self = $class->SUPER::new( $args ); |
14
|
|
|
|
|
|
|
|
15
|
67
|
|
100
|
|
|
1814
|
$self->{values} ||= []; |
16
|
67
|
|
50
|
|
|
330
|
$self->{names} ||= {}; |
17
|
67
|
|
100
|
|
|
432
|
$self->{clear} ||= []; |
18
|
|
|
|
|
|
|
|
19
|
67
|
|
|
|
|
169
|
return $self; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub new_scope { |
23
|
21
|
|
|
21
|
0
|
138
|
my( $self, $outer_scope ) = @_; |
24
|
|
|
|
|
|
|
|
25
|
21
|
|
|
|
|
60
|
my $new = ref( $self )->new( { outer => $outer_scope, |
26
|
21
|
|
|
|
|
30
|
values => [ @{$self->values} ], |
27
|
|
|
|
|
|
|
clear => $self->clear, |
28
|
|
|
|
|
|
|
} ); |
29
|
21
|
|
|
|
|
76
|
my $values = $new->values; |
30
|
21
|
|
|
|
|
78
|
foreach my $clear ( @{$new->{clear}} ) { |
|
21
|
|
|
|
|
47
|
|
31
|
|
|
|
|
|
|
# FIXME lexical initialization |
32
|
8
|
|
|
|
|
21
|
$values->[$clear] = Language::P::Toy::Value::StringNumber->new; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
21
|
|
|
|
|
133
|
return $new; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub add_value { |
39
|
8
|
|
|
8
|
0
|
21
|
my( $self, $lexical, $value ) = @_; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# FIXME lexical initialization |
42
|
8
|
100
|
|
|
|
10
|
push @{$self->values}, @_ > 2 ? $value : Language::P::Toy::Value::StringNumber->new; |
|
8
|
|
|
|
|
23
|
|
43
|
8
|
|
50
|
|
|
129
|
$self->{names}{$lexical->symbol_name} ||= []; |
44
|
8
|
|
|
|
|
96
|
push @{$self->{names}{$lexical->symbol_name}}, $#{$self->values}; |
|
8
|
|
|
|
|
24
|
|
|
8
|
|
|
|
|
80
|
|
45
|
|
|
|
|
|
|
|
46
|
8
|
|
|
|
|
36
|
return $#{$self->values}; |
|
8
|
|
|
|
|
21
|
|
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
0
|
0
|
|
0
|
0
|
|
sub is_empty { return $#{$_[0]->values} == -1 ? 1 : 0 } |
|
0
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |