File Coverage

blib/lib/RPerl/Operation/Expression/Operator/NamedUnary/Log.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/log.html
3             # SUPPORTED: log EXPR
4             # NOT SUPPORTED: log
5              
6             # [[[ HEADER ]]]
7             package RPerl::Operation::Expression::Operator::NamedUnary::Log;
8 5     5   37 use strict;
  5         13  
  5         192  
9 5     5   34 use warnings;
  5         11  
  5         137  
10 5     5   30 use RPerl::AfterSubclass;
  5         13  
  5         833  
11             our $VERSION = 0.001_000;
12              
13             # [[[ OO INHERITANCE ]]]
14 5     5   42 use parent qw(RPerl::Operation::Expression::Operator::NamedUnary);
  5         13  
  5         36  
15 5     5   353 use RPerl::Operation::Expression::Operator::NamedUnary;
  5         11  
  5         139  
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              
21             # [[[ CONSTANTS ]]]
22 5     5   24 use constant NAME => my string $TYPED_NAME = 'log';
  5         12  
  5         288  
23 5     5   32 use constant ARGUMENTS_MIN => my integer $TYPED_ARGUMENTS_MIN = 1;
  5         12  
  5         251  
24 5     5   30 use constant ARGUMENTS_MAX => my integer $TYPED_ARGUMENTS_MAX = 1;
  5         17  
  5         2424  
25              
26             # [[[ OO PROPERTIES ]]]
27             our hashref $properties = {};
28              
29             # [[[ SUBROUTINES & OO METHODS ]]]
30              
31             our string_hashref::method $ast_to_rperl__generate = sub {
32             ( my object $self, my object $operator_named, my string_hashref $modes) = @_;
33             my string_hashref $rperl_source_group = { PMC => q{} };
34              
35             # RPerl::diag( 'in Operator::NamedUnary::Sine->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" );
36             # RPerl::diag( 'in Operator::NamedUnary::Sine->ast_to_rperl__generate(), received $operator_named = ' . "\n" . RPerl::Parser::rperl_ast__dump($operator_named) . "\n" );
37              
38             my string $operator_named_class = ref $operator_named;
39             if ( $operator_named_class eq 'Operation_80' ) { # Operation -> OP10_NAMED_UNARY_SCOLON
40             die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASRP16, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Named operator '
41             . $operator_named->{children}->[0]
42             . ' requires exactly one argument, dying' )
43             . "\n";
44             }
45             elsif ( $operator_named_class eq 'Operator_99' ) { # Operator -> OP10_NAMED_UNARY SubExpression
46             $rperl_source_group->{PMC} .= $operator_named->{children}->[0] . q{ };
47             my string_hashref $rperl_source_subgroup = $operator_named->{children}->[1]->ast_to_rperl__generate( $modes, $self );
48             RPerl::Generator::source_group_append( $rperl_source_group, $rperl_source_subgroup );
49             }
50             elsif ( $operator_named_class eq 'Operator_100' ) { # Operator -> OP10_NAMED_UNARY
51             die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASRP16, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Named operator '
52             . $operator_named->{children}->[0]
53             . ' requires exactly one argument, dying' )
54             . "\n";
55             }
56             else {
57             die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule '
58             . ($operator_named_class)
59             . ' found where Operation_80, Operator_99, or Operator_100 expected, dying' )
60             . "\n";
61             }
62              
63             return $rperl_source_group;
64             };
65              
66             our string_hashref::method $ast_to_cpp__generate__CPPOPS_PERLTYPES = sub {
67             ( my object $self, my string_hashref $modes) = @_;
68             my string_hashref $cpp_source_group = { CPP => q{// <<< RP::O::E::O::NU::Sin __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>} . "\n" };
69              
70             #...
71             return $cpp_source_group;
72             };
73              
74             our string_hashref::method $ast_to_cpp__generate__CPPOPS_CPPTYPES = sub {
75             ( my object $self, my object $operator_named, my string_hashref $modes) = @_;
76             my string_hashref $cpp_source_group = { CPP => q{} };
77              
78             #RPerl::diag( 'in NamedUnary::Scalar->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" );
79             #RPerl::diag( 'in NamedUnary::Scalar->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $operator_named = ' . "\n" . RPerl::Parser::rperl_ast__dump($operator_named) . "\n");
80              
81             my string $operator_named_class = ref $operator_named;
82              
83             if ( $operator_named_class eq 'Operation_80' ) { # Operation -> OP10_NAMED_UNARY_SCOLON
84             die RPerl::Parser::rperl_rule__replace( 'ERROR EC0GEASCP16, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Named operator '
85             . q{'} . $operator_named->{children}->[0] . q{'}
86             . ' requires exactly one argument, dying' )
87             . "\n";
88             }
89             elsif ( $operator_named_class eq 'Operator_99' ) { # Operator -> OP10_NAMED_UNARY SubExpression
90             my object $subexpression = $operator_named->{children}->[1];
91              
92             $cpp_source_group->{CPP} .= $operator_named->{children}->[0];
93             $cpp_source_group->{CPP} .= '(';
94             my string_hashref $cpp_source_subgroup = $operator_named->{children}->[1]->ast_to_cpp__generate__CPPOPS_CPPTYPES( $modes, $self );
95             RPerl::Generator::source_group_append( $cpp_source_group, $cpp_source_subgroup );
96             $cpp_source_group->{CPP} .= ')';
97             }
98             elsif ( $operator_named_class eq 'Operator_100' ) { # Operator -> OP10_NAMED_UNARY
99             die RPerl::Parser::rperl_rule__replace( 'ERROR EC0GEASCP16, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Named operator '
100             . $operator_named->{children}->[0]
101             . ' requires exactly one argument, dying' )
102             . "\n";
103             }
104             else {
105             die RPerl::Parser::rperl_rule__replace( 'ERROR EC0GEASCP00, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Grammar rule '
106             . ($operator_named_class)
107             . ' found where Operation_80, Operator_99, or Operator_100 expected, dying' )
108             . "\n";
109             }
110              
111             return $cpp_source_group;
112             };
113              
114             1; # end of class