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