File Coverage

blib/lib/RPerl/DataStructure/Array/Reference.pm
Criterion Covered Total %
statement 33 33 100.0
branch n/a
condition n/a
subroutine 11 11 100.0
pod n/a
total 44 44 100.0


line stmt bran cond sub pod time code
1             # [[[ HEADER ]]]
2             package RPerl::DataStructure::Array::Reference;
3 9     9   56 use strict;
  9         22  
  9         1158  
4 9     9   48 use warnings;
  9         20  
  9         1098  
5 9     9   47 use RPerl::AfterSubclass;
  9         16  
  9         2427  
6             our $VERSION = 0.004_000;
7              
8             # [[[ OO INHERITANCE ]]]
9 9     9   63 use parent qw(RPerl::DataType::Modifier::Reference);
  9         17  
  9         49  
10 9     9   1664 use RPerl::DataType::Modifier::Reference;
  9         23  
  9         257  
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             ## no critic qw(Capitalization ProhibitMultiplePackages ProhibitReusedNames) # SYSTEM DEFAULT 3: allow multiple & lower case package names
16              
17             # [[[ INCLUDES ]]]
18             # DEV NOTE: must pre-declare string_hashref::method and object types here, because this file appears on a lower line number in rperltypes.pm
19             #require RPerl::CodeBlock::Subroutine::Method;
20             package # hide from PAUSE indexing
21             string_hashref::method;
22 9     9   40 use strict;
  9         18  
  9         150  
23 9     9   36 use warnings;
  9         17  
  9         283  
24              
25             #require RPerl::Object;
26             package # hide from PAUSE indexing
27             object;
28 9     9   41 use strict;
  9         20  
  9         167  
29 9     9   41 use warnings;
  9         23  
  9         240  
30              
31             package RPerl::DataStructure::Array::Reference;
32 9     9   44 use strict;
  9         17  
  9         168  
33 9     9   38 use warnings;
  9         15  
  9         3698  
34              
35             # [[[ OO PROPERTIES ]]]
36             # NEED FIX: type 'hashref' not yet defined here,
37             # makes it impossible to 'use RPerl::DataStructure::Array;' or 'use RPerl::DataStructure::Hash;',
38             # followed by more cascading errors
39             our hashref $properties = {};
40              
41             #our $properties = {};
42              
43             # [[[ SUBROUTINES & OO METHODS ]]]
44              
45             our string_hashref::method $ast_to_rperl__generate = sub {
46             ( my object $self, my string_hashref $modes) = @_;
47             my string_hashref $rperl_source_group = { PMC => q{} };
48              
49             # RPerl::diag( 'in Array::Reference->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" );
50              
51             my string $self_class = ref $self;
52              
53             # unwrap ArrayReference_197 from SubExpression_139
54             if ( $self_class eq 'SubExpression_139' ) {
55             $self = $self->{children}->[0];
56             $self_class = ref $self;
57             }
58              
59             if ( ($self_class) ne 'ArrayReference_197' ) {
60             die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule '
61             . ($self_class)
62             . ' found where ArrayReference_197 or SubExpression_139 expected, dying' )
63             . "\n";
64             }
65              
66             # ArrayReference -> LBRACKET OPTIONAL-45 ']'
67             my string $left_bracket = $self->{children}->[0];
68             my object $list_elements_optional = $self->{children}->[1];
69             my string $right_bracket = $self->{children}->[2];
70              
71             $rperl_source_group->{PMC} .= $left_bracket;
72              
73             if ( exists $list_elements_optional->{children}->[0] ) {
74             my string_hashref $rperl_source_subgroup = $list_elements_optional->{children}->[0]->ast_to_rperl__generate($modes);
75             RPerl::Generator::source_group_append( $rperl_source_group, $rperl_source_subgroup );
76             }
77              
78             $rperl_source_group->{PMC} .= $right_bracket;
79              
80             return $rperl_source_group;
81             };
82              
83             our string_hashref::method $ast_to_cpp__generate__CPPOPS_PERLTYPES = sub {
84             ( my object $self, my string_hashref $modes) = @_;
85             my string_hashref $cpp_source_group = { CPP => q{// <<< RP::DS::A::R __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>} . "\n" };
86              
87             #...
88             return $cpp_source_group;
89             };
90              
91             our string_hashref::method $ast_to_cpp__generate__CPPOPS_CPPTYPES = sub {
92             ( my object $self, my string_hashref $modes) = @_;
93             my string_hashref $cpp_source_group = { CPP => q{} };
94              
95             # RPerl::diag( 'in Array::Reference->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" );
96              
97             my string $self_class = ref $self;
98              
99             # unwrap ArrayReference_197 from SubExpression_139
100             if ( $self_class eq 'SubExpression_139' ) {
101             $self = $self->{children}->[0];
102             $self_class = ref $self;
103             }
104              
105             if ( ($self_class) ne 'ArrayReference_197' ) {
106             die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASCP00, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Grammar rule '
107             . ($self_class)
108             . ' found where ArrayReference_197 or SubExpression_139 expected, dying' )
109             . "\n";
110             }
111              
112             # ArrayReference -> LBRACKET OPTIONAL-45 ']'
113             my object $list_elements_optional = $self->{children}->[1];
114              
115             $cpp_source_group->{CPP} .= '{';
116              
117             if ( exists $list_elements_optional->{children}->[0] ) {
118             my string_hashref $cpp_source_subgroup = $list_elements_optional->{children}->[0]->ast_to_cpp__generate__CPPOPS_CPPTYPES($modes);
119             RPerl::Generator::source_group_append( $cpp_source_group, $cpp_source_subgroup );
120             }
121              
122             $cpp_source_group->{CPP} .= '}';
123              
124             return $cpp_source_group;
125             };
126              
127             1; # end of class