line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# [[[ HEADER ]]] |
2
|
|
|
|
|
|
|
package RPerl::Operation::Statement::Loop::While; |
3
|
4
|
|
|
4
|
|
21
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
98
|
|
4
|
4
|
|
|
4
|
|
17
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
79
|
|
5
|
4
|
|
|
4
|
|
17
|
use RPerl::AfterSubclass; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
488
|
|
6
|
|
|
|
|
|
|
our $VERSION = 0.003_000; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# [[[ OO INHERITANCE ]]] |
9
|
4
|
|
|
4
|
|
24
|
use parent qw(RPerl::Operation::Statement::Loop); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
22
|
|
10
|
4
|
|
|
4
|
|
245
|
use RPerl::Operation::Statement::Loop; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
2298
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# [[[ CRITICS ]]] |
13
|
|
|
|
|
|
|
## no critic qw(ProhibitUselessNoCritic ProhibitMagicNumbers RequireCheckedSyscalls) # USER DEFAULT 1: allow numeric values & print operator |
14
|
|
|
|
|
|
|
## no critic qw(RequireInterpolationOfMetachars) # USER DEFAULT 2: allow single-quoted control characters & sigils |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# [[[ OO PROPERTIES ]]] |
17
|
|
|
|
|
|
|
our hashref $properties = {}; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# [[[ SUBROUTINES & OO METHODS ]]] |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub ast_to_rperl__generate { |
22
|
38
|
|
|
38
|
|
115
|
{ my string_hashref::method $RETURN_TYPE }; |
|
38
|
|
|
|
|
105
|
|
23
|
38
|
|
|
|
|
142
|
( my object $self, my string_hashref $modes) = @ARG; |
24
|
38
|
|
|
|
|
200
|
my string_hashref $rperl_source_group = { PMC => q{} }; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# RPerl::diag( 'in Loop::While->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
27
|
|
|
|
|
|
|
|
28
|
38
|
|
|
|
|
154
|
my string $self_class = ref $self; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# unwrap LoopWhile_184 and LoopWhile_185 from Loop_180 |
31
|
38
|
50
|
|
|
|
178
|
if ( $self_class eq 'Loop_180' ) { # Loop -> LoopWhile |
32
|
38
|
|
|
|
|
156
|
$self = $self->{children}->[0]; |
33
|
38
|
|
|
|
|
129
|
$self_class = ref $self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
38
|
100
|
|
|
|
148
|
if ( $self_class eq 'LoopWhile_184' ) { # LoopWhile -> 'while' LPAREN SubExpression ')' CodeBlock |
|
|
50
|
|
|
|
|
|
37
|
36
|
|
|
|
|
204
|
my string $while = $self->{children}->[0]; |
38
|
36
|
|
|
|
|
132
|
my string $left_paren = $self->{children}->[1]; |
39
|
36
|
|
|
|
|
111
|
my object $subexpression = $self->{children}->[2]; |
40
|
36
|
|
|
|
|
149
|
my string $right_paren = $self->{children}->[3]; |
41
|
36
|
|
|
|
|
111
|
my object $codeblock = $self->{children}->[4]; |
42
|
|
|
|
|
|
|
|
43
|
36
|
|
|
|
|
190
|
$rperl_source_group->{PMC} .= $while . q{ } . $left_paren . q{ }; |
44
|
36
|
|
|
|
|
923
|
my object $rperl_source_subgroup = $subexpression->ast_to_rperl__generate($modes); |
45
|
36
|
|
|
|
|
984
|
RPerl::Generator::source_group_append( $rperl_source_group, $rperl_source_subgroup ); |
46
|
36
|
|
|
|
|
157
|
$rperl_source_group->{PMC} .= q{ } . $right_paren . q{ }; |
47
|
36
|
|
|
|
|
911
|
$rperl_source_subgroup = $codeblock->ast_to_rperl__generate($modes); |
48
|
36
|
|
|
|
|
906
|
RPerl::Generator::source_group_append( $rperl_source_group, $rperl_source_subgroup ); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
elsif ( $self_class eq 'LoopWhile_185' ) { # LoopWhile -> 'while' LPAREN_MY Type VARIABLE_SYMBOL OP19_VARIABLE_ASSIGN SubExpressionOrInput ')' CodeBlock |
51
|
2
|
|
|
|
|
28
|
my string $while = $self->{children}->[0]; |
52
|
2
|
|
|
|
|
8
|
my string $left_paren_my = $self->{children}->[1]; |
53
|
2
|
|
|
|
|
7
|
my string $type = $self->{children}->[2]->{children}->[0]; |
54
|
2
|
|
|
|
|
7
|
my string $variable_symbol = $self->{children}->[3]; |
55
|
2
|
|
|
|
|
7
|
my string $assign = $self->{children}->[4]; |
56
|
2
|
|
|
|
|
4
|
my object $subexpression_or_stdin = $self->{children}->[5]; |
57
|
2
|
|
|
|
|
6
|
my string $right_paren = $self->{children}->[6]; |
58
|
2
|
|
|
|
|
6
|
my object $codeblock = $self->{children}->[7]; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# RPerl::diag( 'in Loop::While->ast_to_rperl__generate(), have $type = ' . "\n" . RPerl::Parser::rperl_ast__dump($type) . "\n" ); |
61
|
|
|
|
|
|
|
|
62
|
2
|
|
|
|
|
12
|
$rperl_source_group->{PMC} .= $while . q{ } . $left_paren_my . q{ } . $type . q{ } . $variable_symbol . q{ } . $assign . q{ }; |
63
|
2
|
|
|
|
|
51
|
my object $rperl_source_subgroup = $subexpression_or_stdin->ast_to_rperl__generate($modes); |
64
|
2
|
|
|
|
|
46
|
RPerl::Generator::source_group_append( $rperl_source_group, $rperl_source_subgroup ); |
65
|
2
|
|
|
|
|
6
|
$rperl_source_group->{PMC} .= q{ } . $right_paren . q{ }; |
66
|
2
|
|
|
|
|
49
|
$rperl_source_subgroup = $codeblock->ast_to_rperl__generate($modes); |
67
|
2
|
|
|
|
|
47
|
RPerl::Generator::source_group_append( $rperl_source_group, $rperl_source_subgroup ); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
else { |
70
|
0
|
|
|
|
|
0
|
die RPerl::Parser::rperl_rule__replace( |
71
|
|
|
|
|
|
|
'ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule ' |
72
|
|
|
|
|
|
|
. $self_class |
73
|
|
|
|
|
|
|
. ' found where LoopWhile_184 or LoopWhile_185 expected, dying' ) |
74
|
|
|
|
|
|
|
. "\n"; |
75
|
|
|
|
|
|
|
} |
76
|
38
|
|
|
|
|
274
|
return $rperl_source_group; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub ast_to_cpp__generate__CPPOPS_PERLTYPES { |
80
|
0
|
|
|
0
|
|
|
{ my string_hashref::method $RETURN_TYPE }; |
|
0
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
( my object $self, my string_hashref $modes) = @ARG; |
82
|
0
|
|
|
|
|
|
my string_hashref $cpp_source_group |
83
|
|
|
|
|
|
|
= { CPP => |
84
|
|
|
|
|
|
|
q{// <<< RP::O::S::L::W __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>} |
85
|
|
|
|
|
|
|
. "\n" }; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
#... |
88
|
0
|
|
|
|
|
|
return $cpp_source_group; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub ast_to_cpp__generate__CPPOPS_CPPTYPES { |
92
|
0
|
|
|
0
|
|
|
{ my string_hashref::method $RETURN_TYPE }; |
|
0
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
( my object $self, my string $loop_label, my string_hashref $modes) = @ARG; |
94
|
0
|
|
|
|
|
|
my string_hashref $cpp_source_group = { CPP => q{} }; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
# RPerl::diag( 'in Loop::While->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
97
|
|
|
|
|
|
|
# RPerl::diag( 'in Loop::While->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $loop_label = ' . $loop_label . "\n" ); |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
my string $self_class = ref $self; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# unwrap LoopWhile_184 from Loop_180 |
102
|
0
|
0
|
|
|
|
|
if ( $self_class eq 'Loop_180' ) { # Loop -> LoopWhile |
103
|
0
|
|
|
|
|
|
$self = $self->{children}->[0]; |
104
|
0
|
|
|
|
|
|
$self_class = ref $self; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
0
|
0
|
|
|
|
|
if ( $self_class eq 'LoopWhile_184' ) { # LoopWhile -> 'while' LPAREN SubExpression ')' CodeBlock |
|
|
0
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
my string $while = $self->{children}->[0]; |
109
|
0
|
|
|
|
|
|
my string $left_paren = $self->{children}->[1]; |
110
|
0
|
|
|
|
|
|
my object $subexpression = $self->{children}->[2]; |
111
|
0
|
|
|
|
|
|
my string $right_paren = $self->{children}->[3]; |
112
|
0
|
|
|
|
|
|
my object $codeblock = $self->{children}->[4]; |
113
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
$cpp_source_group->{CPP} .= $while . q{ } . $left_paren . q{ }; |
115
|
0
|
|
|
|
|
|
my object $cpp_source_subgroup = $subexpression->ast_to_cpp__generate__CPPOPS_CPPTYPES($modes); |
116
|
0
|
|
|
|
|
|
RPerl::Generator::source_group_append( $cpp_source_group, $cpp_source_subgroup ); |
117
|
0
|
|
|
|
|
|
$cpp_source_group->{CPP} .= q{ } . $right_paren . q{ }; |
118
|
0
|
|
|
|
|
|
$cpp_source_subgroup = $codeblock->ast_to_cpp__generate__CPPOPS_CPPTYPES($loop_label, $modes); |
119
|
0
|
|
|
|
|
|
RPerl::Generator::source_group_append( $cpp_source_group, $cpp_source_subgroup ); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
elsif ( $self_class eq 'LoopWhile_185' ) { # LoopWhile -> 'while' LPAREN_MY Type VARIABLE_SYMBOL OP19_VARIABLE_ASSIGN SubExpressionOrInput ')' CodeBlock |
122
|
0
|
|
|
|
|
|
$cpp_source_group = { CPP => q{// <<< RP::O::S::L::W __DUMMY_SOURCE_CODE CPPOPS_CPPTYPES >>>} . "\n" }; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
else { |
125
|
0
|
|
|
|
|
|
die RPerl::Parser::rperl_rule__replace( |
126
|
|
|
|
|
|
|
'ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule ' |
127
|
|
|
|
|
|
|
. $self_class |
128
|
|
|
|
|
|
|
. ' found where LoopWhile_184 or LoopWhile_185 expected, dying' ) |
129
|
|
|
|
|
|
|
. "\n"; |
130
|
|
|
|
|
|
|
} |
131
|
0
|
|
|
|
|
|
return $cpp_source_group; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
1; # end of class |