File Coverage

blib/lib/RPerl/Operation/Expression/Operator/Named/Exp.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/exp.html
3             # SUPPORTED: exp VALUE
4             # NOT SUPPORTED: exp
5              
6             # [[[ HEADER ]]]
7             package RPerl::Operation::Expression::Operator::Named::Exp;
8 5     5   31 use strict;
  5         12  
  5         130  
9 5     5   26 use warnings;
  5         14  
  5         107  
10 5     5   27 use RPerl::AfterSubclass;
  5         14  
  5         641  
11             our $VERSION = 0.001_000;
12              
13             # [[[ OO INHERITANCE ]]]
14 5     5   35 use parent qw(RPerl::Operation::Expression::Operator::Named);
  5         14  
  5         29  
15 5     5   308 use RPerl::Operation::Expression::Operator::Named;
  5         10  
  5         141  
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   26 use constant NAME => my string $TYPED_NAME = 'exp';
  5         12  
  5         294  
24              
25             # DEV NOTE: with min & max args of 1, compile-time args length checking short-circuited first by Parse Phase 0 ERROR ECOPAPL03 'Useless use of FOO in void context'
26             # or ERROR ECOPARP00 'Unexpected Token: ,'; short-circuited second by ERROR ECOGEASRP13 on Operator_84 & OperatorVoid_122 multiple-argument productions below;
27             # can't figure out how to create test which gets past ECOPAPL03 & ECOPARP00 to trigger ECOGEASRP13
28 5     5   29 use constant ARGUMENTS_MIN => my integer $TYPED_ARGUMENTS_MIN = 1;
  5         19  
  5         227  
29 5     5   29 use constant ARGUMENTS_MAX => my integer $TYPED_ARGUMENTS_MAX = 1;
  5         16  
  5         2612  
30              
31             # [[[ OO PROPERTIES ]]]
32             our hashref $properties = {};
33              
34             # [[[ OO METHODS & SUBROUTINES ]]]
35              
36             our string_hashref::method $ast_to_rperl__generate = sub {
37             ( my object $self, my object $operator_named, my string_hashref $modes) = @_;
38             my string_hashref $rperl_source_group = { PMC => q{} };
39              
40             # RPerl::diag( 'in Operator::Named::AbsoluteValue->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" );
41             # RPerl::diag( 'in Operator::Named::AbsoluteValue->ast_to_rperl__generate(), received $operator_named = ' . "\n" . RPerl::Parser::rperl_ast__dump($operator_named) . "\n" );
42              
43             my string $operator_named_class = ref $operator_named;
44             if ( $operator_named_class eq 'Operation_79' ) { # Operation -> OP01_NAMED_SCOLON
45             die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASRP15, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: named operator '
46             . $operator_named->{children}->[0]
47             . ' requires exactly one argument, dying' )
48             . "\n";
49             }
50             elsif ( $operator_named_class eq 'Operator_83' ) { # Operator -> OP01_NAMED SubExpression
51             $rperl_source_group->{PMC} .= $operator_named->{children}->[0] . q{ };
52             my string_hashref $rperl_source_subgroup = $operator_named->{children}->[1]->ast_to_rperl__generate( $modes, $self );
53             RPerl::Generator::source_group_append( $rperl_source_group, $rperl_source_subgroup );
54             }
55             elsif ( $operator_named_class eq 'Operator_84' ) { # Operator -> LPAREN OP01_NAMED ListElement OP21_LIST_COMMA ListElements ')'
56             die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASRP13a, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: named operator '
57             . $operator_named->{children}->[1]
58             . ' does not accept multiple arguments, dying' )
59             . "\n";
60             }
61             elsif ( $operator_named_class eq 'OperatorVoid_122' ) { # OperatorVoid -> OP01_NAMED ListElement OP21_LIST_COMMA ListElements ';'
62             die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASRP13b, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: named operator '
63             . $operator_named->{children}->[0]
64             . ' does not accept multiple arguments, dying' )
65             . "\n";
66             }
67             else {
68             die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: grammar rule '
69             . ($operator_named_class)
70             . ' found where Operation_79, Operator_83, Operator_84, or OperatorVoid_122 expected, dying' )
71             . "\n";
72             }
73              
74             return $rperl_source_group;
75             };
76              
77             our string_hashref::method $ast_to_cpp__generate__CPPOPS_PERLTYPES = sub {
78             ( my object $self, my string_hashref $modes) = @_;
79             my string_hashref $cpp_source_group = { CPP => q{// <<< RP::O::E::O::N::Abs __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>} . "\n" };
80              
81             #...
82             return $cpp_source_group;
83             };
84              
85             our string_hashref::method $ast_to_cpp__generate__CPPOPS_CPPTYPES = sub {
86             ( my object $self, my object $operator_named, my string_hashref $modes) = @_;
87             my string_hashref $cpp_source_group = { CPP => q{} };
88              
89             # RPerl::diag( 'in Operator::Named::AbsoluteValue->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" );
90             # RPerl::diag( 'in Operator::Named::AbsoluteValue->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $operator_named = ' . "\n" . RPerl::Parser::rperl_ast__dump($operator_named) . "\n" );
91              
92             my string $operator_named_class = ref $operator_named;
93             if ( $operator_named_class eq 'Operation_79' ) { # Operation -> OP01_NAMED_SCOLON
94             die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASCP15, CODE GENERATOR, ABSTRACT SYNTAX TO C++: named operator '
95             . $operator_named->{children}->[0]
96             . ' requires exactly one argument, dying' )
97             . "\n";
98             }
99             elsif ( $operator_named_class eq 'Operator_83' ) { # Operator -> OP01_NAMED SubExpression
100             $cpp_source_group->{CPP} .= $operator_named->{children}->[0];
101             $cpp_source_group->{CPP} .= '(';
102             my string_hashref $cpp_source_subgroup = $operator_named->{children}->[1]->ast_to_cpp__generate__CPPOPS_CPPTYPES( $modes, $self );
103             RPerl::Generator::source_group_append( $cpp_source_group, $cpp_source_subgroup );
104             $cpp_source_group->{CPP} .= ')';
105             }
106             elsif ( $operator_named_class eq 'Operator_84' ) { # Operator -> LPAREN OP01_NAMED ListElement OP21_LIST_COMMA ListElements ')'
107             die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASCP14a, CODE GENERATOR, ABSTRACT SYNTAX TO C++: named operator '
108             . $operator_named->{children}->[1]
109             . ' does not accept multiple arguments, dying' )
110             . "\n";
111             }
112             elsif ( $operator_named_class eq 'OperatorVoid_122' ) { # OperatorVoid -> OP01_NAMED ListElement OP21_LIST_COMMA ListElements ';'
113             die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASCP14b, CODE GENERATOR, ABSTRACT SYNTAX TO C++: named operator '
114             . $operator_named->{children}->[0]
115             . ' does not accept multiple arguments, dying' )
116             . "\n";
117             }
118             else {
119             die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASCP00, CODE GENERATOR, ABSTRACT SYNTAX TO C++: grammar rule '
120             . ($operator_named_class)
121             . ' found where Operation_79, Operator_83, Operator_84, or OperatorVoid_122 expected, dying' )
122             . "\n";
123             }
124              
125             return $cpp_source_group;
126             };
127              
128             1; # end of class