line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# [[[ HEADER ]]] |
2
|
|
|
|
|
|
|
package RPerl::Operation::Expression::ConstantCall; |
3
|
5
|
|
|
5
|
|
33
|
use strict; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
178
|
|
4
|
5
|
|
|
5
|
|
35
|
use warnings; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
125
|
|
5
|
5
|
|
|
5
|
|
27
|
use RPerl::AfterSubclass; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
673
|
|
6
|
|
|
|
|
|
|
our $VERSION = 0.003_100; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# [[[ OO INHERITANCE ]]] |
9
|
5
|
|
|
5
|
|
35
|
use parent qw(RPerl::Operation::Expression); |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
26
|
|
10
|
5
|
|
|
5
|
|
278
|
use RPerl::Operation::Expression; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
1890
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# [[[ CRITICS ]]] |
13
|
|
|
|
|
|
|
## no critic qw(ProhibitUselessNoCritic ProhibitMagicNumbers RequireCheckedSyscalls) # USER DEFAULT 1: allow numeric values & print operator |
14
|
|
|
|
|
|
|
## no critic qw(RequireInterpolationOfMetachars) # USER DEFAULT 2: allow single-quoted control characters & sigils |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# [[[ OO PROPERTIES ]]] |
17
|
|
|
|
|
|
|
our hashref $properties = {}; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# [[[ SUBROUTINES & OO METHODS ]]] |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our string_hashref::method $ast_to_rperl__generate = sub { |
22
|
|
|
|
|
|
|
( my object $self, my string_hashref $modes) = @_; |
23
|
|
|
|
|
|
|
my string_hashref $rperl_source_group = { PMC => q{} }; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# RPerl::diag( 'in ConstantCall->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
if ( ( ref $self ) eq 'Expression_130' ) { # Expression -> WORD_UPPERCASE LPAREN ')' |
28
|
|
|
|
|
|
|
my string $name = $self->{children}->[0]; |
29
|
|
|
|
|
|
|
my string $left_paren = $self->{children}->[1]; |
30
|
|
|
|
|
|
|
my string $right_paren = $self->{children}->[2]; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$rperl_source_group->{PMC} .= $name . $left_paren . $right_paren; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
elsif ( ( ref $self ) eq 'Expression_131' ) { # Expression -> CONSTANT_CALL_SCOPED |
35
|
|
|
|
|
|
|
$rperl_source_group->{PMC} .= $self->{children}->[0]; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
else { |
38
|
|
|
|
|
|
|
die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule ' |
39
|
|
|
|
|
|
|
. ( ref $self ) |
40
|
|
|
|
|
|
|
. ' found where Expression_130 or Expression_131 expected, dying' ) |
41
|
|
|
|
|
|
|
. "\n"; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
return $rperl_source_group; |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
our string_hashref::method $ast_to_cpp__generate__CPPOPS_PERLTYPES = sub { |
48
|
|
|
|
|
|
|
( my object $self, my string_hashref $modes) = @_; |
49
|
|
|
|
|
|
|
my string_hashref $cpp_source_group = { CPP => q{// <<< RP::O::E::CC __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>} . "\n" }; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
#... |
52
|
|
|
|
|
|
|
return $cpp_source_group; |
53
|
|
|
|
|
|
|
}; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
our string_hashref::method $ast_to_cpp__generate__CPPOPS_CPPTYPES = sub { |
56
|
|
|
|
|
|
|
( my object $self, my string_hashref $modes) = @_; |
57
|
|
|
|
|
|
|
my string_hashref $cpp_source_group = { CPP => q{} }; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# RPerl::diag( 'in ConstantCall->ast_to_cpp__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
if ( ( ref $self ) eq 'Expression_130' ) { |
62
|
|
|
|
|
|
|
# Expression -> WORD_UPPERCASE LPAREN ')' |
63
|
|
|
|
|
|
|
my string $name = $self->{children}->[0]; |
64
|
|
|
|
|
|
|
$cpp_source_group->{CPP} .= $name; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
elsif ( ( ref $self ) eq 'Expression_131' ) { |
67
|
|
|
|
|
|
|
# Expression -> Expression -> CONSTANT_CALL_SCOPED |
68
|
|
|
|
|
|
|
my string $call = $self->{children}->[0]; |
69
|
|
|
|
|
|
|
substr $call, -2, 2, q{}; # strip trailing parenthesis |
70
|
|
|
|
|
|
|
$call =~ s/:/_/gxms; |
71
|
|
|
|
|
|
|
$cpp_source_group->{CPP} .= $call; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
else { |
74
|
|
|
|
|
|
|
die RPerl::Parser::rperl_rule__replace( |
75
|
|
|
|
|
|
|
'ERROR ECOGEASCP00, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Grammar rule ' |
76
|
|
|
|
|
|
|
. ( ref $self ) |
77
|
|
|
|
|
|
|
. ' found where Expression_130 or Expression_131 expected, dying' ) |
78
|
|
|
|
|
|
|
. "\n"; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
return $cpp_source_group; |
82
|
|
|
|
|
|
|
}; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; # end of class |