File Coverage

blib/lib/RPerl/Operation/Expression/Operator/Named/Shift.pm
Criterion Covered Total %
statement 34 48 70.8
branch 2 8 25.0
condition n/a
subroutine 9 11 81.8
pod n/a
total 45 67 67.1


line stmt bran cond sub pod time code
1             # [[[ DOCUMENTATION ]]]
2             # http://perldoc.perl.org/functions/shift.html
3             # SUPPORTED: shift ARRAY
4             # NOT SUPPORTED: shift
5              
6             # [[[ HEADER ]]]
7             package RPerl::Operation::Expression::Operator::Named::Shift;
8 4     4   27 use strict;
  4         11  
  4         108  
9 4     4   24 use warnings;
  4         8  
  4         88  
10 4     4   19 use RPerl::AfterSubclass;
  4         10  
  4         508  
11             our $VERSION = 0.002_000;
12              
13             # [[[ OO INHERITANCE ]]]
14 4     4   26 use parent qw(RPerl::Operation::Expression::Operator::Named);
  4         8  
  4         21  
15 4     4   267 use RPerl::Operation::Expression::Operator::Named;
  4         8  
  4         114  
16              
17             # [[[ CRITICS ]]]
18             ## no critic qw(ProhibitUselessNoCritic ProhibitMagicNumbers RequireCheckedSyscalls) # USER DEFAULT 1: allow numeric values & print operator
19             ## no critic qw(RequireInterpolationOfMetachars) # USER DEFAULT 2: allow single-quoted control characters & sigils
20             ## no critic qw(ProhibitConstantPragma ProhibitMagicNumbers) # USER DEFAULT 3: allow constants
21              
22             # [[[ CONSTANTS ]]]
23 4     4   21 use constant NAME => my string $TYPED_NAME = 'shift';
  4         12  
  4         246  
24 4     4   22 use constant ARGUMENTS_MIN => my integer $TYPED_ARGUMENTS_MIN = 1;
  4         8  
  4         210  
25 4     4   27 use constant ARGUMENTS_MAX => my integer $TYPED_ARGUMENTS_MAX = 1;
  4         8  
  4         1393  
26              
27             # [[[ OO PROPERTIES ]]]
28             our hashref $properties = {};
29              
30             # [[[ SUBROUTINES & OO METHODS ]]]
31              
32             sub ast_to_rperl__generate {
33 3     3   12 { my string_hashref::method $RETURN_TYPE };
  3         13  
34 3         14 ( my object $self, my object $operator_named, my string_hashref $modes)
35             = @ARG;
36 3         20 my string_hashref $rperl_source_group = { PMC => q{} };
37              
38             # RPerl::diag( 'in Operator::Named::Shift->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" );
39             # RPerl::diag( 'in Operator::Named::Shift->ast_to_rperl__generate(), received $operator_named = ' . "\n" . RPerl::Parser::rperl_ast__dump($operator_named) . "\n" );
40              
41 3         13 my string $operator_named_class = ref $operator_named;
42 3 50       28 if ( $operator_named_class eq 'Operation_90' ) { # Operation -> OP01_NAMED_SCOLON
    50          
    0          
    0          
43             die RPerl::Parser::rperl_rule__replace(
44             'ERROR ECOGEASRP16, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Named operator '
45 0         0 . $operator_named->{children}->[0]
46             . ' requires exactly one argument, dying' )
47             . "\n";
48             }
49             elsif ( $operator_named_class eq 'Operator_94' ) { # Operator -> OP01_NAMED SubExpression
50 3         23 $rperl_source_group->{PMC} .= $operator_named->{children}->[0] . q{ };
51             my string_hashref $rperl_source_subgroup
52 3         90 = $operator_named->{children}->[1]
53             ->ast_to_rperl__generate( $modes, $self );
54 3         82 RPerl::Generator::source_group_append( $rperl_source_group,
55             $rperl_source_subgroup );
56             }
57             elsif ( $operator_named_class eq 'Operator_95' ) { # Operator -> LPAREN OP01_NAMED ListElement OP21_LIST_COMMA ListElements ')'
58             die RPerl::Parser::rperl_rule__replace(
59             'ERROR ECOGEASRP14, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Named operator '
60 0         0 . $operator_named->{children}->[1]
61             . ' does not accept multiple arguments, dying' )
62             . "\n";
63             }
64             elsif ( $operator_named_class eq 'OperatorVoid_134' ) { # OperatorVoid -> OP01_NAMED ListElement OP21_LIST_COMMA ListElements ';'
65             die RPerl::Parser::rperl_rule__replace(
66             'ERROR ECOGEASRP14, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Named operator '
67 0         0 . $operator_named->{children}->[0]
68             . ' does not accept multiple arguments, dying' )
69             . "\n";
70             }
71             else {
72 0         0 die RPerl::Parser::rperl_rule__replace(
73             'ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule '
74             . ($operator_named_class)
75             . ' found where Operation_90, Operator_94, Operator_95, or OperatorVoid_134 expected, dying'
76             ) . "\n";
77             }
78 3         17 return $rperl_source_group;
79             }
80              
81             sub ast_to_cpp__generate__CPPOPS_PERLTYPES {
82 0     0     { my string_hashref::method $RETURN_TYPE };
  0            
83 0           ( my object $self, my string_hashref $modes) = @ARG;
84 0           my string_hashref $cpp_source_group
85             = { CPP =>
86             q{// <<< RP::O::E::O::N::Po __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>}
87             . "\n" };
88              
89             #...
90 0           return $cpp_source_group;
91             }
92              
93             sub ast_to_cpp__generate__CPPOPS_CPPTYPES {
94 0     0     { my string_hashref::method $RETURN_TYPE };
  0            
95 0           ( my object $self, my string_hashref $modes) = @ARG;
96 0           my string_hashref $cpp_source_group
97             = { CPP =>
98             q{// <<< RP::O::E::O::N::Po __DUMMY_SOURCE_CODE CPPOPS_CPPTYPES >>>}
99             . "\n" };
100              
101             #...
102 0           return $cpp_source_group;
103             }
104              
105             1; # end of class