our
$VERSION
= 0.005_000;
our
hashref
$properties
= {};
our
string_hashref::method
$ast_to_rperl__generate
=
sub
{
(
my
object
$self
,
my
string_hashref
$modes
) =
@_
;
my
string_hashref
$rperl_source_group
= {
PMC
=>
q{}
};
my
string_hashref
$rperl_source_subgroup
;
if
( (
ref
$self
) eq
'MethodOrSubroutine_78'
) {
$self
=
$self
->{children}->[0];
}
if
( (
ref
$self
) ne
'Method_73'
) {
die
RPerl::Parser::rperl_rule__replace(
'ERROR ECVGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: grammar rule '
. (
ref
$self
) .
' found where Method_73 expected, dying'
)
.
"\n"
;
}
my
string
$our
=
$self
->{children}->[0];
my
string
$return_type
=
$self
->{children}->[1];
my
string
$name
=
$self
->{children}->[2];
my
string
$equal_sub
=
$self
->{children}->[3];
my
object
$arguments_optional
=
$self
->{children}->[4];
my
object
$operations_star
=
$self
->{children}->[5];
my
string
$right_brace
=
$self
->{children}->[6];
my
string
$semicolon
=
$self
->{children}->[7];
if
((
substr
$name
, 1, 1) eq
'_'
) {
die
'ERROR ECVGEASRP09, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: method name '
. (
$name
)
.
' must not start with underscore, dying'
.
"\n"
;
}
$rperl_source_group
->{PMC} .=
$our
.
q{ }
.
$return_type
.
q{ }
.
$name
.
q{ }
.
$equal_sub
.
"\n"
;
if
(
exists
$arguments_optional
->{children}->[0] ) {
$rperl_source_subgroup
=
$arguments_optional
->{children}->[0]->ast_to_rperl__generate(
$modes
);
RPerl::Generator::source_group_append(
$rperl_source_group
,
$rperl_source_subgroup
);
}
foreach
my
object
$operation
( @{
$operations_star
->{children} } ) {
$rperl_source_subgroup
=
$operation
->ast_to_rperl__generate(
$modes
);
RPerl::Generator::source_group_append(
$rperl_source_group
,
$rperl_source_subgroup
);
}
$rperl_source_group
->{PMC} .=
$right_brace
.
$semicolon
.
"\n\n"
;
return
$rperl_source_group
;
};
our
string_hashref::method
$ast_to_cpp__generate__CPPOPS_PERLTYPES
=
sub
{
(
my
object
$self
,
my
string_hashref
$modes
) =
@_
;
my
string_hashref
$cpp_source_group
= {
CPP
=>
q{// <<< RP::CB::S::M __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>}
.
"\n"
};
return
$cpp_source_group
;
};
our
string_hashref::method
$ast_to_cpp__generate_declaration__CPPOPS_CPPTYPES
=
sub
{
(
my
object
$self
,
my
string_hashref
$modes
) =
@_
;
my
string_hashref
$cpp_source_group
= {
H
=>
q{}
};
$self
=
$self
->{children}->[0];
my
string
$return_type
=
$self
->{children}->[1];
my
string
$name
=
$self
->{children}->[2];
my
object
$arguments_optional
=
$self
->{children}->[4];
substr
$name
, 0, 1,
q{}
;
substr
$return_type
, -8, 8,
''
;
if
((
substr
$name
, 0, 1) eq
'_'
) {
die
'ERROR ECVGEASCP09, CODE GENERATOR, ABSTRACT SYNTAX TO C++: method name '
. (
$name
)
.
' must not start with underscore, dying'
.
"\n"
;
}
$modes
->{_symbol_table}->{_subroutine} =
$name
;
$modes
->{_symbol_table}->{
$modes
->{_symbol_table}->{_namespace}}->{_global}->{
$name
} = {
isa
=>
'RPerl::CodeBlock::Subroutine::Method'
,
type
=>
$return_type
};
$return_type
= RPerl::Generator::type_convert_perl_to_cpp(
$return_type
, 1);
$modes
->{_symbol_table}->{
$modes
->{_symbol_table}->{_namespace}}->{_global}->{
$name
}->{type_cpp} =
$return_type
;
$cpp_source_group
->{H} .=
q{ }
.
$return_type
.
q{ }
.
$name
.
'('
;
if
(
exists
$arguments_optional
->{children}->[0] ) {
my
object
$arguments
=
$arguments_optional
->{children}->[0];
my
string_hashref
$cpp_source_subgroup
=
$arguments
->ast_to_cpp__generate__CPPOPS_CPPTYPES(
$modes
);
$cpp_source_group
->{H} .=
$cpp_source_subgroup
->{CPP};
}
$cpp_source_group
->{H} .=
');'
;
return
$cpp_source_group
;
};
our
string_hashref::method
$ast_to_cpp__generate__CPPOPS_CPPTYPES
=
sub
{
(
my
object
$self
,
my
string
$package_name_underscores
,
my
string_hashref
$modes
) =
@_
;
my
string_hashref
$cpp_source_group
= {
CPP
=>
q{}
};
my
string_hashref
$cpp_source_subgroup
;
if
( (
ref
$self
) eq
'MethodOrSubroutine_78'
) {
$self
=
$self
->{children}->[0];
}
if
( (
ref
$self
) ne
'Method_73'
) {
die
RPerl::Parser::rperl_rule__replace(
'ERROR ECVGEASCP00, CODE GENERATOR, ABSTRACT SYNTAX TO C++: grammar rule '
. (
ref
$self
) .
' found where Method_73 expected, dying'
)
.
"\n"
;
}
my
string
$return_type
=
$self
->{children}->[1];
my
string
$name
=
$self
->{children}->[2];
my
object
$arguments_optional
=
$self
->{children}->[4];
my
object
$operations_star
=
$self
->{children}->[5];
substr
$name
, 0, 1,
q{}
;
substr
$return_type
, -8, 8,
''
;
$return_type
= RPerl::Generator::type_convert_perl_to_cpp(
$return_type
, 1);
$cpp_source_group
->{CPP} .=
$return_type
.
q{ }
.
$package_name_underscores
.
'::'
.
$name
.
'('
;
if
(
exists
$arguments_optional
->{children}->[0] ) {
$cpp_source_subgroup
=
$arguments_optional
->{children}->[0]->ast_to_cpp__generate__CPPOPS_CPPTYPES(
$modes
);
RPerl::Generator::source_group_append(
$cpp_source_group
,
$cpp_source_subgroup
);
}
$cpp_source_group
->{CPP} .=
') {'
.
"\n"
;
my
string
$CPP_saved
=
$cpp_source_group
->{CPP};
$cpp_source_group
->{CPP} =
q{}
;
foreach
my
object
$operation
( @{
$operations_star
->{children} } ) {
$cpp_source_subgroup
=
$operation
->ast_to_cpp__generate__CPPOPS_CPPTYPES(
$modes
);
RPerl::Generator::source_group_append(
$cpp_source_group
,
$cpp_source_subgroup
);
}
if
((
exists
$modes
->{_loop_iterators}) and (
defined
$modes
->{_loop_iterators})) {
foreach
my
string
$loop_iterator_symbol
(
sort
keys
%{
$modes
->{_loop_iterators}}) {
$CPP_saved
.=
$modes
->{_loop_iterators}->{
$loop_iterator_symbol
} .
q{ }
.
$loop_iterator_symbol
.
';'
.
"\n"
;
}
delete
$modes
->{_loop_iterators};
}
$CPP_saved
.=
$cpp_source_group
->{CPP};
$cpp_source_group
->{CPP} =
$CPP_saved
;
$cpp_source_group
->{CPP} .=
'}'
;
return
$cpp_source_group
;
};
package
method;
package
void::method;
use
parent -norequire,
qw(method)
;
package
integer::method;
use
parent -norequire,
qw(method)
;
package
float::method;
use
parent -norequire,
qw(method)
;
package
number::method;
use
parent -norequire,
qw(method)
;
package
char::method;
use
parent -norequire,
qw(method)
;
package
string::method;
use
parent -norequire,
qw(method)
;
package
scalartype::method;
use
parent -norequire,
qw(method)
;
package
unknown::method;
use
parent -norequire,
qw(method)
;
package
integer_hashref::method;
use
parent -norequire,
qw(method)
;
package
number_hashref::method;
use
parent -norequire,
qw(method)
;
package
string_hashref::method;
use
parent -norequire,
qw(method)
;
package
object_hashref::method;
use
parent -norequire,
qw(method)
;
package
hashref_hashref::method;
use
parent -norequire,
qw(method)
;
package
integer_arrayref::method;
use
parent -norequire,
qw(method)
;
package
number_arrayref::method;
use
parent -norequire,
qw(method)
;
package
string_arrayref::method;
use
parent -norequire,
qw(method)
;
package
arrayref_arrayref::method;
use
parent -norequire,
qw(method)
;
1;