line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::sh2p::Statement;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1853
|
use strict;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
25
|
|
5
|
1
|
|
|
1
|
|
5
|
use Carp;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
85
|
|
6
|
1
|
|
|
1
|
|
8
|
use Scalar::Util qw(refaddr);
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
57
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use App::sh2p::Utils;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
286
|
|
9
|
1
|
|
|
1
|
|
6
|
use App::sh2p::Parser;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
780
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub App::sh2p::Parser::convert(\@\@);
|
12
|
|
|
|
|
|
|
our $VERSION = '0.06';
|
13
|
|
|
|
|
|
|
###########################################################################
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my %tokens;
|
16
|
|
|
|
|
|
|
my %types;
|
17
|
|
|
|
|
|
|
my %stdin;
|
18
|
|
|
|
|
|
|
my %stdout;
|
19
|
|
|
|
|
|
|
my %stderr;
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
###########################################################################
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new {
|
24
|
0
|
|
|
0
|
0
|
|
my ($class) = @_;
|
25
|
0
|
|
|
|
|
|
my $this = bless \do{my $some_scalar}, $class;
|
|
0
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
my $key = refaddr $this;
|
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
$tokens{$key} = [];
|
29
|
0
|
|
|
|
|
|
$types {$key} = [];
|
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
return $this;
|
32
|
|
|
|
|
|
|
}
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
###########################################################################
|
35
|
|
|
|
|
|
|
# Create a new object as a copy of this
|
36
|
|
|
|
|
|
|
sub copy {
|
37
|
0
|
|
|
0
|
0
|
|
my ($this) = @_;
|
38
|
0
|
|
|
|
|
|
my $key = refaddr $this;
|
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my $new = bless \do{my $some_scalar}, ref($this);
|
|
0
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
my $newkey = refaddr $new;
|
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
$tokens{$newkey} = [];
|
44
|
0
|
|
|
|
|
|
push @{$tokens{$newkey}}, @{$tokens{$key}};
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
$types {$newkey} = [];
|
47
|
0
|
|
|
|
|
|
push @{$types{$newkey}}, @{$types{$key}};
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
return $new;
|
50
|
|
|
|
|
|
|
}
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
###########################################################################
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub DESTROY {
|
55
|
0
|
|
|
0
|
|
|
my ($this) = @_;
|
56
|
0
|
|
|
|
|
|
my $key = refaddr $this;
|
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
$tokens{$key} = undef;
|
59
|
0
|
|
|
|
|
|
$types {$key} = undef;
|
60
|
|
|
|
|
|
|
}
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
###########################################################################
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub tokenise {
|
65
|
0
|
|
|
0
|
0
|
|
my ($this, $line) = @_;
|
66
|
0
|
|
|
|
|
|
my $key = refaddr $this;
|
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
push @{$tokens{$key}}, App::sh2p::Parser::tokenise ($line);
|
|
0
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
}
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
###########################################################################
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub add_token {
|
74
|
0
|
|
|
0
|
0
|
|
my ($this, $token_text) = @_;
|
75
|
0
|
|
|
|
|
|
my $key = refaddr $this;
|
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
push @{$tokens{$key}}, $token_text;
|
|
0
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
}
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
###########################################################################
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub add_break {
|
83
|
0
|
|
|
0
|
0
|
|
my ($this) = @_;
|
84
|
0
|
|
|
|
|
|
my $key = refaddr $this;
|
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
push @{$tokens{$key}}, set_break();
|
|
0
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
}
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
###########################################################################
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub push_case {
|
92
|
0
|
|
|
0
|
0
|
|
my ($this) = @_;
|
93
|
0
|
|
|
|
|
|
my $key = refaddr $this;
|
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
App::sh2p::Compound::push_case (@{$tokens{$key}});
|
|
0
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
}
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
###########################################################################
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub identify_tokens {
|
102
|
0
|
|
|
0
|
0
|
|
my ($this, $nested) = @_;
|
103
|
0
|
|
|
|
|
|
my $key = refaddr $this;
|
104
|
|
|
|
|
|
|
|
105
|
0
|
0
|
|
|
|
|
if ( @{$tokens{$key}} ) {
|
|
0
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
push @{$types{$key}},
|
|
0
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
App::sh2p::Parser::identify ($nested, @{$tokens{$key}});
|
108
|
|
|
|
|
|
|
}
|
109
|
|
|
|
|
|
|
}
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
###########################################################################
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub convert_tokens {
|
114
|
0
|
|
|
0
|
0
|
|
my ($this) = @_;
|
115
|
0
|
|
|
|
|
|
my $key = refaddr $this;
|
116
|
|
|
|
|
|
|
|
117
|
0
|
0
|
|
|
|
|
if ( @{$tokens{$key}} ) {
|
|
0
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
App::sh2p::Parser::convert (@{$tokens{$key}}, @{$types{$key}});
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
}
|
120
|
|
|
|
|
|
|
}
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
###########################################################################
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
1; |