our
$VERSION
= 0.007_000;
our
hashref
$properties
= {};
sub
ast_to_rperl__generate {
{
my
string_hashref::method
$RETURN_TYPE
};
(
my
object
$self
,
my
string_hashref
$modes
) =
@ARG
;
my
string_hashref
$rperl_source_group
= {
PMC
=>
q{}
};
my
string
$module_name
;
if
(
ref
$self
eq
'Include_54'
) {
my
string
$use_keyword
=
$self
->{children}->[0];
$module_name
=
$self
->{children}->[1]->{children}->[0];
my
string
$qw
=
q{}
;
if
(
defined
$self
->{children}->[2]->{children}->[0]) {
$qw
=
$self
->{children}->[2]->{children}->[0]->{attr};
}
my
string
$semicolon
=
$self
->{children}->[3];
$rperl_source_group
->{PMC} .=
$use_keyword
.
q{ }
.
$module_name
.
q{ }
.
$qw
.
$semicolon
.
"\n"
;
}
elsif
(
ref
$self
eq
'Include_55'
) {
my
string
$init_keyword
=
$self
->{children}->[0];
my
string
$left_brace
=
$self
->{children}->[1];
$module_name
=
$self
->{children}->[2]->{children}->[0];
my
string
$thinarrow_import_left_parentheses
=
$self
->{children}->[3];
my
string
$qw
=
q{}
;
if
(
defined
$self
->{children}->[4]->{children}->[0]) {
$qw
=
$self
->{children}->[4]->{children}->[0]->{attr};
}
my
string
$right_parentheses
=
$self
->{children}->[5];
my
string
$semicolon
=
$self
->{children}->[6];
my
string
$right_brace
=
$self
->{children}->[7];
$rperl_source_group
->{PMC} .=
$init_keyword
.
q{ }
.
$left_brace
.
q{ }
.
$module_name
.
$thinarrow_import_left_parentheses
.
q{ }
.
$qw
.
q{ }
.
$right_parentheses
.
q{ }
.
$semicolon
.
q{ }
.
$right_brace
.
"\n"
;
}
else
{
die
RPerl::Parser::rperl_rule__replace(
'ERROR ECOGEASRP000, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule '
. (
ref
$self
)
.
' found where Include_54 or Include_55 expected, dying'
)
.
"\n"
;
}
if
((
substr
$module_name
, 0, 1) eq
'_'
) {
die
'ERROR ECOGEASRP185a, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL:'
.
"\n"
.
'included package or class name '
.
q{'}
.
$module_name
.
q{'}
.
' must not start with an underscore, forbidden by C++ specification as a reserved identifier, dying'
.
"\n"
;
}
elsif
(
$module_name
=~ m/__/gxms) {
die
'ERROR ECOGEASRP185c, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL:'
.
"\n"
.
'included package or class name '
.
q{'}
.
$module_name
.
q{'}
.
' must not include a double-underscore, forbidden by C++ specification as a reserved identifier, dying'
.
"\n"
;
}
return
$rperl_source_group
;
}
sub
ast_to_cpp__generate__CPPOPS_PERLTYPES {
{
my
string_hashref::method
$RETURN_TYPE
};
(
my
object
$self
,
my
string_hashref
$modes
) =
@ARG
;
my
string_hashref
$cpp_source_group
= {
CPP
=>
q{// <<< RP::CU::I __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>}
.
"\n"
};
return
$cpp_source_group
;
}
sub
ast_to_cpp__generate__CPPOPS_CPPTYPES {
{
my
string_hashref::method
$RETURN_TYPE
};
(
my
object
$self
,
my
string
$package_name_underscores
,
my
string_hashref
$modes
) =
@ARG
;
my
string_hashref
$cpp_source_group
= {
H
=>
q{}
};
if
((
ref
$self
eq
'Include_54'
) or (
ref
$self
eq
'Include_55'
)) {
my
string
$module_name
;
if
(
ref
$self
eq
'Include_54'
) {
$module_name
=
$self
->{children}->[1]->{children}->[0];
}
else
{
$module_name
=
$self
->{children}->[2]->{children}->[0];
}
if
((
substr
$module_name
, 0, 1) eq
'_'
) {
die
'ERROR ECOGEASCP185a, CODE GENERATOR, ABSTRACT SYNTAX TO C++:'
.
"\n"
.
'included package or class name '
.
q{'}
.
$module_name
.
q{'}
.
' must not start with an underscore, forbidden by C++ specification as a reserved identifier, dying'
.
"\n"
;
}
elsif
(
$module_name
=~ m/__/gxms) {
die
'ERROR ECOGEASCP185c, CODE GENERATOR, ABSTRACT SYNTAX TO C++:'
.
"\n"
.
'included package or class name '
.
q{'}
.
$module_name
.
q{'}
.
' must not include a double-underscore, forbidden by C++ specification as a reserved identifier, dying'
.
"\n"
;
}
my
boolean
$is_rperl_system
= 0;
my
boolean
$is_rperl_test
= 0;
if
( ( (
substr
$module_name
, 0, 5 ) eq
'RPerl'
) or ( (
substr
$module_name
, 0, 5 ) eq
'rperl'
) ) {
if
( (
substr
$module_name
, 0, 11 ) eq
'RPerl::Test'
) {
$is_rperl_test
= 1;
}
else
{
$is_rperl_system
= 1;
}
}
if
(
$module_name
=~ /^\w+Perl::Config$/ ) {
}
elsif
(
$is_rperl_test
or (not
$is_rperl_system
) ) {
if
((not
exists
$cpp_source_group
->{_PMC_includes}) or (not
defined
$cpp_source_group
->{_PMC_includes})) {
$cpp_source_group
->{_PMC_includes} = {};
}
elsif
((not
exists
$cpp_source_group
->{_PMC_includes}->{
$package_name_underscores
})
or (not
defined
$cpp_source_group
->{_PMC_includes}->{
$package_name_underscores
})) {
$cpp_source_group
->{_PMC_includes}->{
$package_name_underscores
} =
q{}
;
}
$cpp_source_group
->{_PMC_includes}->{
$package_name_underscores
} .=
'require '
.
$module_name
.
';'
.
"\n"
;
$module_name
=~ s/::/\//gxms;
$cpp_source_group
->{H} .=
q{#include "}
.
$module_name
.
q{.cpp"}
.
"\n"
;
}
else
{
delete
$cpp_source_group
->{H};
}
}
else
{
die
RPerl::Parser::rperl_rule__replace(
'ERROR ECOGEASCP000, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Grammar rule '
. (
ref
$self
) .
' found where Include_54 or Include_55 expected, dying'
) .
"\n"
;
}
return
$cpp_source_group
;
}
1;