line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# [[[ DOCUMENTATION ]]] |
2
|
|
|
|
|
|
|
# http://perldoc.perl.org/functions/defined.html |
3
|
|
|
|
|
|
|
# SUPPORTED: defined EXPR |
4
|
|
|
|
|
|
|
# NOT SUPPORTED: defined |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# [[[ HEADER ]]] |
7
|
|
|
|
|
|
|
package RPerl::Operation::Expression::Operator::NamedUnary::Defined; |
8
|
5
|
|
|
5
|
|
32
|
use strict; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
131
|
|
9
|
5
|
|
|
5
|
|
23
|
use warnings; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
103
|
|
10
|
5
|
|
|
5
|
|
29
|
use RPerl::AfterSubclass; |
|
5
|
|
|
|
|
53
|
|
|
5
|
|
|
|
|
718
|
|
11
|
|
|
|
|
|
|
our $VERSION = 0.002_000; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# [[[ OO INHERITANCE ]]] |
14
|
5
|
|
|
5
|
|
39
|
use parent qw(RPerl::Operation::Expression::Operator::NamedUnary); |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
31
|
|
15
|
5
|
|
|
5
|
|
295
|
use RPerl::Operation::Expression::Operator::NamedUnary; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
148
|
|
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
|
|
31
|
use constant NAME => my string $TYPED_NAME = 'defined'; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
297
|
|
23
|
5
|
|
|
5
|
|
30
|
use constant ARGUMENTS_MIN => my integer $TYPED_ARGUMENTS_MIN = 1; |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
265
|
|
24
|
5
|
|
|
5
|
|
29
|
use constant ARGUMENTS_MAX => my integer $TYPED_ARGUMENTS_MAX = 1; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
1549
|
|
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::Defined->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
36
|
|
|
|
|
|
|
# RPerl::diag( 'in Operator::NamedUnary::Defined->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::D __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 string_hashref $modes) = @_; |
76
|
|
|
|
|
|
|
my string_hashref $cpp_source_group = { CPP => q{// <<< RP::O::E::O::NU::D __DUMMY_SOURCE_CODE CPPOPS_CPPTYPES >>>} . "\n" }; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
#... |
79
|
|
|
|
|
|
|
return $cpp_source_group; |
80
|
|
|
|
|
|
|
}; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; # end of class |