line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# [[[ DOCUMENTATION ]]] |
2
|
|
|
|
|
|
|
# http://perldoc.perl.org/functions/rand.html |
3
|
|
|
|
|
|
|
# SUPPORTED: rand EXPR |
4
|
|
|
|
|
|
|
# SUPPORTED: rand |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# [[[ HEADER ]]] |
7
|
|
|
|
|
|
|
package RPerl::Operation::Expression::Operator::NamedUnary::Random; |
8
|
4
|
|
|
4
|
|
23
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
95
|
|
9
|
4
|
|
|
4
|
|
20
|
use warnings; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
97
|
|
10
|
4
|
|
|
4
|
|
22
|
use RPerl::AfterSubclass; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
582
|
|
11
|
|
|
|
|
|
|
our $VERSION = 0.002_000; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# [[[ OO INHERITANCE ]]] |
14
|
4
|
|
|
4
|
|
28
|
use parent qw(RPerl::Operation::Expression::Operator::NamedUnary); |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
21
|
|
15
|
4
|
|
|
4
|
|
218
|
use RPerl::Operation::Expression::Operator::NamedUnary; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
115
|
|
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
|
|
17
|
use constant NAME => my string $TYPED_NAME = 'rand'; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
198
|
|
23
|
4
|
|
|
4
|
|
21
|
use constant ARGUMENTS_MIN => my integer $TYPED_ARGUMENTS_MIN = 0; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
177
|
|
24
|
4
|
|
|
4
|
|
21
|
use constant ARGUMENTS_MAX => my integer $TYPED_ARGUMENTS_MAX = 1; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
1101
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# [[[ OO PROPERTIES ]]] |
27
|
|
|
|
|
|
|
our hashref $properties = {}; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# [[[ SUBROUTINES & OO METHODS ]]] |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub ast_to_rperl__generate { |
32
|
4
|
|
|
4
|
|
10
|
{ my string_hashref::method $RETURN_TYPE }; |
|
4
|
|
|
|
|
14
|
|
33
|
4
|
|
|
|
|
13
|
( my object $self, my object $operator_named, my string_hashref $modes) |
34
|
|
|
|
|
|
|
= @ARG; |
35
|
4
|
|
|
|
|
18
|
my string_hashref $rperl_source_group = { PMC => q{} }; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# RPerl::diag( 'in Operator::NamedUnary::Random->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
38
|
|
|
|
|
|
|
# RPerl::diag( 'in Operator::NamedUnary::Random->ast_to_rperl__generate(), received $operator_named = ' . "\n" . RPerl::Parser::rperl_ast__dump($operator_named) . "\n" ); |
39
|
|
|
|
|
|
|
|
40
|
4
|
|
|
|
|
12
|
my string $operator_named_class = ref $operator_named; |
41
|
4
|
50
|
|
|
|
29
|
if ( $operator_named_class eq 'Operation_91' ) { # Operation -> OP10_NAMED_UNARY_SCOLON |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
42
|
0
|
|
|
|
|
0
|
$rperl_source_group->{PMC} .= $operator_named->{children}->[0]; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
elsif ( $operator_named_class eq 'Operator_110' ) { # Operator -> OP10_NAMED_UNARY SubExpression |
45
|
2
|
|
|
|
|
15
|
$rperl_source_group->{PMC} .= $operator_named->{children}->[0] . q{ }; |
46
|
|
|
|
|
|
|
my string_hashref $rperl_source_subgroup |
47
|
2
|
|
|
|
|
48
|
= $operator_named->{children}->[1] |
48
|
|
|
|
|
|
|
->ast_to_rperl__generate( $modes, $self ); |
49
|
2
|
|
|
|
|
47
|
RPerl::Generator::source_group_append( $rperl_source_group, |
50
|
|
|
|
|
|
|
$rperl_source_subgroup ); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
elsif ( $operator_named_class eq 'Operator_111' ) { # Operator -> OP10_NAMED_UNARY |
53
|
2
|
|
|
|
|
6
|
$rperl_source_group->{PMC} .= $operator_named->{children}->[0]; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
else { |
56
|
0
|
|
|
|
|
0
|
die RPerl::Parser::rperl_rule__replace( |
57
|
|
|
|
|
|
|
'ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule ' |
58
|
|
|
|
|
|
|
. ($operator_named_class) |
59
|
|
|
|
|
|
|
. ' found where Operation_91, Operator_110, or Operator_111 expected, dying' |
60
|
|
|
|
|
|
|
) . "\n"; |
61
|
|
|
|
|
|
|
} |
62
|
4
|
|
|
|
|
14
|
return $rperl_source_group; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub ast_to_cpp__generate__CPPOPS_PERLTYPES { |
66
|
0
|
|
|
0
|
|
|
{ my string_hashref::method $RETURN_TYPE }; |
|
0
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
( my object $self, my string_hashref $modes) = @ARG; |
68
|
0
|
|
|
|
|
|
my string_hashref $cpp_source_group = { CPP => q{// <<< RP::O::E::O::NU::R __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>} . "\n" }; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
#... |
71
|
0
|
|
|
|
|
|
return $cpp_source_group; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub ast_to_cpp__generate__CPPOPS_CPPTYPES { |
75
|
0
|
|
|
0
|
|
|
{ my string_hashref::method $RETURN_TYPE }; |
|
0
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
( my object $self, my string_hashref $modes) = @ARG; |
77
|
0
|
|
|
|
|
|
my string_hashref $cpp_source_group = { CPP => q{// <<< RP::O::E::O::NU::R __DUMMY_SOURCE_CODE CPPOPS_CPPTYPES >>>} . "\n" }; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
#... |
80
|
0
|
|
|
|
|
|
return $cpp_source_group; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; # end of class |