File Coverage

blib/lib/RPerl/Operation/Expression/Operator/Named/Pop.pm
Criterion Covered Total %
statement 24 24 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod n/a
total 32 32 100.0


line stmt bran cond sub pod time code
1             # [[[ DOCUMENTATION ]]]
2             # http://perldoc.perl.org/functions/pop.html
3             # SUPPORTED: pop ARRAY
4             # NOT SUPPORTED: pop
5              
6             # [[[ HEADER ]]]
7             package RPerl::Operation::Expression::Operator::Named::Pop;
8 5     5   29 use strict;
  5         13  
  5         129  
9 5     5   22 use warnings;
  5         10  
  5         104  
10 5     5   28 use RPerl::AfterSubclass;
  5         12  
  5         689  
11             our $VERSION = 0.002_100;
12              
13             # [[[ OO INHERITANCE ]]]
14 5     5   40 use parent qw(RPerl::Operation::Expression::Operator::Named);
  5         13  
  5         35  
15 5     5   325 use RPerl::Operation::Expression::Operator::Named;
  5         14  
  5         167  
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 5     5   27 use constant NAME => my string $TYPED_NAME = 'pop';
  5         11  
  5         345  
24 5     5   31 use constant ARGUMENTS_MIN => my integer $TYPED_ARGUMENTS_MIN = 1;
  5         30  
  5         299  
25 5     5   34 use constant ARGUMENTS_MAX => my integer $TYPED_ARGUMENTS_MAX = 1;
  5         14  
  5         1682  
26              
27             # [[[ OO PROPERTIES ]]]
28             our hashref $properties = {};
29              
30             # [[[ SUBROUTINES & OO METHODS ]]]
31              
32             our string_hashref::method $ast_to_rperl__generate = sub {
33             ( my object $self, my object $operator_named, my string_hashref $modes)
34             = @_;
35             my string_hashref $rperl_source_group = { PMC => q{} };
36              
37             # RPerl::diag( 'in Operator::Named::Pop->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" );
38             # RPerl::diag( 'in Operator::Named::Pop->ast_to_rperl__generate(), received $operator_named = ' . "\n" . RPerl::Parser::rperl_ast__dump($operator_named) . "\n" );
39              
40             my string $operator_named_class = ref $operator_named;
41             if ( $operator_named_class eq 'Operation_79' ) { # Operation -> OP01_NAMED_SCOLON
42             die RPerl::Parser::rperl_rule__replace(
43             'ERROR ECOGEASRP16, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Named operator '
44             . $operator_named->{children}->[0]
45             . ' requires exactly one argument, dying' )
46             . "\n";
47             }
48             elsif ( $operator_named_class eq 'Operator_83' ) { # Operator -> OP01_NAMED SubExpression
49             $rperl_source_group->{PMC} .= $operator_named->{children}->[0] . q{ };
50             my string_hashref $rperl_source_subgroup
51             = $operator_named->{children}->[1]
52             ->ast_to_rperl__generate( $modes, $self );
53             RPerl::Generator::source_group_append( $rperl_source_group,
54             $rperl_source_subgroup );
55             }
56             elsif ( $operator_named_class eq 'Operator_84' ) { # Operator -> LPAREN OP01_NAMED ListElement OP21_LIST_COMMA ListElements ')'
57             die RPerl::Parser::rperl_rule__replace(
58             'ERROR ECOGEASRP14, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Named operator '
59             . $operator_named->{children}->[1]
60             . ' does not accept multiple arguments, dying' )
61             . "\n";
62             }
63             elsif ( $operator_named_class eq 'OperatorVoid_122' ) { # OperatorVoid -> OP01_NAMED ListElement OP21_LIST_COMMA ListElements ';'
64             die RPerl::Parser::rperl_rule__replace(
65             'ERROR ECOGEASRP14, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Named operator '
66             . $operator_named->{children}->[0]
67             . ' does not accept multiple arguments, dying' )
68             . "\n";
69             }
70             else {
71             die RPerl::Parser::rperl_rule__replace(
72             'ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule '
73             . ($operator_named_class)
74             . ' found where Operation_79, Operator_83, Operator_84, or OperatorVoid_122 expected, dying'
75             ) . "\n";
76             }
77              
78              
79             return $rperl_source_group;
80             };
81              
82             our string_hashref::method $ast_to_cpp__generate__CPPOPS_PERLTYPES = sub {
83             ( my object $self, my string_hashref $modes) = @_;
84             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             return $cpp_source_group;
91             };
92              
93             our string_hashref::method $ast_to_cpp__generate__CPPOPS_CPPTYPES = sub {
94             ( my object $self, my string_hashref $modes) = @_;
95             my string_hashref $cpp_source_group
96             = { CPP =>
97             q{// <<< RP::O::E::O::N::Po __DUMMY_SOURCE_CODE CPPOPS_CPPTYPES >>>}
98             . "\n" };
99              
100             #...
101             return $cpp_source_group;
102             };
103              
104             1; # end of class