File Coverage

blib/lib/RPerl/Operation/Expression/SubExpression/Variable/Retrieval.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
1             # [[[ HEADER ]]]
2             package RPerl::Operation::Expression::SubExpression::Variable::Retrieval;
3 4     4   29 use strict;
  4         12  
  4         121  
4 4     4   23 use warnings;
  4         10  
  4         108  
5 4     4   26 use RPerl::AfterSubclass;
  4         11  
  4         629  
6             our $VERSION = 0.004_000;
7              
8             # [[[ OO INHERITANCE ]]]
9 4     4   32 use parent qw(RPerl::Operation::Expression::SubExpression);
  4         13  
  4         28  
10 4     4   276 use RPerl::Operation::Expression::SubExpression;
  4         13  
  4         4584  
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             our string_hashref::method $ast_to_rperl__generate = sub {
22             ( my object $self, my string_hashref $modes) = @_;
23             my string_hashref $rperl_source_group = { PMC => q{} };
24              
25             # RPerl::diag( 'in Variable::Retrieval->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" );
26              
27             my string $self_class = ref $self;
28             if ( $self_class eq 'VariableRetrieval_178' ) { # VariableRetrieval -> OP02_ARRAY_THINARROW SubExpression ']'
29             my string $arrow_left_bracket = $self->{children}->[0];
30             my object $subexpression = $self->{children}->[1];
31             my string $right_bracket = $self->{children}->[2];
32              
33             $rperl_source_group->{PMC} .= $arrow_left_bracket . q{ };
34             my string_hashref $rperl_source_subgroup = $subexpression->ast_to_rperl__generate($modes);
35             RPerl::Generator::source_group_append( $rperl_source_group, $rperl_source_subgroup );
36             $rperl_source_group->{PMC} .= q{ } . $right_bracket;
37             }
38             elsif ( $self_class eq 'VariableRetrieval_179' ) { # VariableRetrieval -> OP02_HASH_THINARROW SubExpression '}'
39             my string $arrow_left_brace = $self->{children}->[0];
40             my object $subexpression = $self->{children}->[1];
41             my string $right_brace = $self->{children}->[2];
42              
43             $rperl_source_group->{PMC} .= $arrow_left_brace . q{ };
44             my string_hashref $rperl_source_subgroup = $subexpression->ast_to_rperl__generate($modes);
45             RPerl::Generator::source_group_append( $rperl_source_group, $rperl_source_subgroup );
46             $rperl_source_group->{PMC} .= q{ } . $right_brace;
47             }
48             elsif ( $self_class eq 'VariableRetrieval_180' ) { # VariableRetrieval -> OP02_HASH_THINARROW WORD '}'
49             my string $arrow_left_brace = $self->{children}->[0];
50             my string $word = $self->{children}->[1];
51             my string $right_brace = $self->{children}->[2];
52              
53             $rperl_source_group->{PMC} .= $arrow_left_brace . q{ } . $word . q{ } . $right_brace;
54             }
55             else {
56             die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule '
57             . ($self_class)
58             . ' found where VariableRetrieval_178, VariableRetrieval_178, or VariableRetrieval_178 expected, dying' )
59             . "\n";
60             }
61              
62             return $rperl_source_group;
63             };
64              
65             our string_hashref::method $ast_to_cpp__generate__CPPOPS_PERLTYPES = sub {
66             ( my object $self, my string_hashref $modes) = @_;
67             my string_hashref $cpp_source_group = { CPP => q{// <<< RP::O::E::SE::V::R __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>} . "\n" };
68              
69             #...
70             return $cpp_source_group;
71             };
72              
73             our string_hashref::method $ast_to_cpp__generate__CPPOPS_CPPTYPES = sub {
74             ( my object $self, my string $variable_symbol, my string $base_type, my string_hashref $modes) = @_;
75             my string_hashref $cpp_source_group = { CPP => q{} };
76              
77             # RPerl::diag( 'in Variable::Retrieval->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" );
78              
79             my string $self_class = ref $self;
80             my string $subtype;
81             if ( $self_class eq 'VariableRetrieval_178' ) { # VariableRetrieval -> OP02_ARRAY_THINARROW SubExpression ']'
82             my object $subexpression = $self->{children}->[1];
83             if ( $base_type =~ /_arrayref$/ ) { # array
84             $subtype = substr $base_type, 0, ( ( length $base_type ) - 9 ); # strip trailing '_arrayref'
85             if ( exists $rperlnamespaces_generated::RPERL->{ $subtype . '::' } ) {
86             if ( $subtype eq 'arrayref' ) { # arrayref of arrayrefs
87             die 'NEED TEST & IMPLEMENT!!!';
88             }
89             elsif ( $subtype eq 'hashref' ) { # arrayref of hashrefs
90             die 'NEED TEST & IMPLEMENT!!!';
91             }
92             elsif ( $subtype =~ /sse_number_pair$/xms ) { # arrayref of SSE number pairs
93             die 'NEED TEST & IMPLEMENT!!!';
94             }
95             else { # arrayref of scalars
96             $cpp_source_group->{CPP} .= '[';
97             my string_hashref $cpp_source_subgroup = $subexpression->ast_to_cpp__generate__CPPOPS_CPPTYPES($modes);
98             RPerl::Generator::source_group_append( $cpp_source_group, $cpp_source_subgroup );
99             $cpp_source_group->{CPP} .= ']';
100             }
101             }
102             else { # arrayref of user-defined data types (objects)
103             $cpp_source_group->{CPP} .= '[';
104             my string_hashref $cpp_source_subgroup = $subexpression->ast_to_cpp__generate__CPPOPS_CPPTYPES($modes);
105             RPerl::Generator::source_group_append( $cpp_source_group, $cpp_source_subgroup );
106             $cpp_source_group->{CPP} .= ']';
107             }
108             }
109             elsif ( $base_type eq 'sse_number_pair' ) { # SSE 2-element array
110             $cpp_source_group->{CPP} .= '[';
111             my string_hashref $cpp_source_subgroup = $subexpression->ast_to_cpp__generate__CPPOPS_CPPTYPES($modes);
112             RPerl::Generator::source_group_append( $cpp_source_group, $cpp_source_subgroup );
113             $cpp_source_group->{CPP} .= ']';
114             }
115             elsif ( $base_type =~ /_hashref$/ ) { # hash
116             die 'ERROR ECOGEASCPxd, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Variable retrieval, can not use arrayref retrieval on hashref type ' . $base_type . ', dying' . "\n";
117             }
118             elsif ( exists $rperlnamespaces_generated::RPERL->{ $base_type . '::' } ) { # scalar
119             die 'ERROR ECOGEASCPxd, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Variable retrieval, can not use arrayref retrieval on scalar type ' . $base_type . ', dying' . "\n";
120             }
121             else { # user-defined type AKA class
122             die 'ERROR ECOGEASCPxd, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Variable retrieval, can not use arrayref retrieval on object of user-defined class ' . $base_type . ', dying' . "\n";
123             }
124             }
125             elsif ( $self_class eq 'VariableRetrieval_179' ) { # VariableRetrieval -> OP02_HASH_THINARROW SubExpression '}'
126             my object $subexpression = $self->{children}->[1];
127             if ( $base_type =~ /_arrayref$/ ) { # array
128             die 'ERROR ECOGEASCPxd, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Variable retrieval, can not use hashref retrieval on arrayref type ' . $base_type . ', dying' . "\n";
129             }
130             elsif ( $base_type eq 'sse_number_pair' ) {
131             die 'ERROR ECOGEASCPxd, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Variable retrieval, can not use hashref retrieval on SSE type ' . $base_type . ', dying' . "\n";
132             }
133             elsif ( $base_type =~ /_hashref$/ ) { # hash
134             $subtype = substr $base_type, 0, ( ( length $base_type ) - 8 ); # strip trailing '_hashref'
135             if ( exists $rperlnamespaces_generated::RPERL->{ $subtype . '::' } ) {
136             if ( $subtype eq 'arrayref' ) { # hashrefs of arrayrefs
137             die 'NEED TEST & IMPLEMENT!!!';
138             }
139             elsif ( $subtype eq 'hashref' ) { # hashrefs of hashrefs
140             die 'NEED TEST & IMPLEMENT!!!';
141             }
142             elsif ( $subtype =~ /sse_number_pair$/xms ) { # hashref of SSE number pairs
143             die 'NEED TEST & IMPLEMENT!!!';
144             }
145             else { # hashrefs of scalars
146             $cpp_source_group->{CPP} .= '[';
147             my string_hashref $cpp_source_subgroup = $subexpression->ast_to_cpp__generate__CPPOPS_CPPTYPES($modes);
148             RPerl::Generator::source_group_append( $cpp_source_group, $cpp_source_subgroup );
149             $cpp_source_group->{CPP} .= ']';
150             }
151             }
152             else { # hashref of user-defined data types (objects)
153             $cpp_source_group->{CPP} .= '[';
154             my string_hashref $cpp_source_subgroup = $subexpression->ast_to_cpp__generate__CPPOPS_CPPTYPES($modes);
155             RPerl::Generator::source_group_append( $cpp_source_group, $cpp_source_subgroup );
156             $cpp_source_group->{CPP} .= ']';
157             }
158             }
159             elsif ( exists $rperlnamespaces_generated::RPERL->{ $base_type . '::' } ) { # scalar
160             die 'ERROR ECOGEASCPxd, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Variable retrieval, can not use hashref retrieval on scalar type ' . $base_type . ', dying' . "\n";
161             }
162             else { # user-defined type AKA class
163             $cpp_source_group->{CPP} .= '->';
164             my string_hashref $cpp_source_subgroup = $subexpression->ast_to_cpp__generate__CPPOPS_CPPTYPES($modes);
165             RPerl::Generator::source_group_append( $cpp_source_group, $cpp_source_subgroup );
166             }
167             }
168             elsif ( $self_class eq 'VariableRetrieval_180' ) { # VariableRetrieval -> OP02_HASH_THINARROW WORD '}'
169             my string $word = $self->{children}->[1];
170              
171             if ( $base_type =~ /_arrayref$/ ) { # array
172             die 'ERROR ECOGEASCPxd, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Variable retrieval, can not use hashref retrieval on arrayref type ' . $base_type . ', dying' . "\n";
173             }
174             elsif ( $base_type eq 'sse_number_pair' ) {
175             die 'ERROR ECOGEASCPxd, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Variable retrieval, can not use hashref retrieval on SSE type ' . $base_type . ', dying' . "\n";
176             }
177             elsif ( $base_type =~ /_hashref$/ ) { # hash
178             $subtype = substr $base_type, 0, ( ( length $base_type ) - 8 ); # strip trailing '_hashref'
179             if ( exists $rperlnamespaces_generated::RPERL->{ $subtype . '::' } ) {
180             if ( $subtype eq 'arrayref' ) { # hashrefs of arrayrefs
181             die 'NEED TEST & IMPLEMENT!!!';
182             }
183             elsif ( $subtype eq 'hashref' ) { # hashrefs of hashrefs
184             die 'NEED TEST & IMPLEMENT!!!';
185             }
186             elsif ( $subtype =~ /sse_number_pair$/xms ) { # hashref of SSE number pairs
187             die 'NEED TEST & IMPLEMENT!!!';
188             }
189             else { # hashrefs of scalars
190             $cpp_source_group->{CPP} .= '[' . $word . ']';
191             }
192             }
193             else { # hashref of user-defined data types (objects)
194             $cpp_source_group->{CPP} .= '[' . $word . ']';
195             }
196             }
197             elsif ( exists $rperlnamespaces_generated::RPERL->{ $base_type . '::' } ) { # scalar
198             die 'ERROR ECOGEASCPxd, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Variable retrieval, can not use hashref retrieval on scalar type ' . $base_type . ', dying' . "\n";
199             }
200             else { # user-defined type AKA class
201             $cpp_source_group->{CPP} .= '->' . $word;
202             }
203              
204             }
205             else {
206             die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASCP00, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Grammar rule '
207             . ($self_class)
208             . ' found where VariableRetrieval_178, VariableRetrieval_178, or VariableRetrieval_178 expected, dying' )
209             . "\n";
210             }
211              
212             return $cpp_source_group;
213             };
214              
215             1; # end of class