"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/RPerl/Operation/Expression/Operator/Named/Keys.pm" between
RPerl-5.000000.tar.gz and RPerl-5.002000.tar.gz

About: RPerl is an optimizing compiler for the Perl 5 programming language (converting Perl 5 source code into C++).

Keys.pm  (RPerl-5.000000):Keys.pm  (RPerl-5.002000)
skipping to change at line 23 skipping to change at line 23
# [[[ OO INHERITANCE ]]] # [[[ OO INHERITANCE ]]]
use parent qw(RPerl::Operation::Expression::Operator::Named); use parent qw(RPerl::Operation::Expression::Operator::Named);
use RPerl::Operation::Expression::Operator::Named; use RPerl::Operation::Expression::Operator::Named;
# [[[ CRITICS ]]] # [[[ CRITICS ]]]
## no critic qw(ProhibitUselessNoCritic ProhibitMagicNumbers RequireCheckedSysca lls) # USER DEFAULT 1: allow numeric values & print operator ## no critic qw(ProhibitUselessNoCritic ProhibitMagicNumbers RequireCheckedSysca lls) # USER DEFAULT 1: allow numeric values & print operator
## no critic qw(RequireInterpolationOfMetachars) # USER DEFAULT 2: allow single -quoted control characters & sigils ## no critic qw(RequireInterpolationOfMetachars) # USER DEFAULT 2: allow single -quoted control characters & sigils
## no critic qw(ProhibitConstantPragma ProhibitMagicNumbers) # USER DEFAULT 3: allow constants ## no critic qw(ProhibitConstantPragma ProhibitMagicNumbers) # USER DEFAULT 3: allow constants
# [[[ CONSTANTS ]]] # [[[ CONSTANTS ]]]
use constant NAME => my string $TYPED_NAME = 'keys'; use constant NAME => my string $TYPED_NAME =
use constant ARGUMENTS_MIN => my integer $TYPED_ARGUMENTS_MIN = 1; 'keys';
use constant ARGUMENTS_MAX => my integer $TYPED_ARGUMENTS_MAX = 1; use constant NAME_CPPOPS_PERLTYPES => my string $TYPED_NAME_CPPOPS_PERLTYPES =
'DUMMY_OP_SCALAR';
use constant NAME_CPPOPS_CPPTYPES => my string $TYPED_NAME_CPPOPS_CPPTYPES =
'keys';
use constant ARGUMENTS_MIN => my integer $TYPED_ARGUMENTS_MIN =
1;
use constant ARGUMENTS_MAX => my integer $TYPED_ARGUMENTS_MAX =
1;
# [[[ OO PROPERTIES ]]] # [[[ OO PROPERTIES ]]]
our hashref $properties = {}; our hashref $properties = {};
# [[[ SUBROUTINES & OO METHODS ]]] # [[[ SUBROUTINES & OO METHODS ]]]
sub ast_to_rperl__generate { sub ast_to_rperl__generate {
{ my string_hashref::method $RETURN_TYPE }; { my string_hashref::method $RETURN_TYPE };
( my object $self, my object $operator_named, my string_hashref $modes) = @A RG; ( my object $self, my object $operator_named, my string_hashref $modes) = @A RG;
my string_hashref $rperl_source_group = { PMC => q{} }; my string_hashref $rperl_source_group = { PMC => q{} };
skipping to change at line 82 skipping to change at line 84
my string_hashref $cpp_source_group my string_hashref $cpp_source_group
= { CPP => q{// <<< RP::O::E::O::N::K __DUMMY_SOURCE_CODE CPPOPS_PERLTYP ES >>>} . "\n" }; = { CPP => q{// <<< RP::O::E::O::N::K __DUMMY_SOURCE_CODE CPPOPS_PERLTYP ES >>>} . "\n" };
#... #...
return $cpp_source_group; return $cpp_source_group;
} }
sub ast_to_cpp__generate__CPPOPS_CPPTYPES { sub ast_to_cpp__generate__CPPOPS_CPPTYPES {
{ my string_hashref::method $RETURN_TYPE }; { my string_hashref::method $RETURN_TYPE };
( my object $self, my object $operator_named, my string_hashref $modes) = @A RG; ( my object $self, my object $operator_named, my string_hashref $modes) = @A RG;
my string_hashref $cpp_source_group = { CPP => q{} }; my string_hashref $cpp_source_group
= { CPP => q{} };
# RPerl::diag( 'in Operator::Named::Keys->ast_to_cpp__generate__CPPOPS_CPPTYP ES(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ) ; # RPerl::diag( 'in Operator::Named::Keys->ast_to_cpp__generate__CPPOPS_CPPTYP ES(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ) ;
# RPerl::diag( 'in Operator::Named::Keys->ast_to_cpp__generate__CPPOPS_CPPTYP ES(), received $operator_named = ' . "\n" . RPerl::Parser::rperl_ast__dump($oper ator_named) . "\n" ); # RPerl::diag( 'in Operator::Named::Keys->ast_to_cpp__generate__CPPOPS_CPPTYP ES(), received $operator_named = ' . "\n" . RPerl::Parser::rperl_ast__dump($oper ator_named) . "\n" );
my string $operator_named_class = ref $operator_named; my string $operator_named_class = ref $operator_named;
if ( $operator_named_class eq 'Operation_96' ) { # Operation -> OP01_NAMED_ SCOLON if ( $operator_named_class eq 'Operation_96' ) { # Operation -> OP01_NAMED_ SCOLON
die RPerl::Parser::rperl_rule__replace( die RPerl::Parser::rperl_rule__replace(
'ERROR ECOGEASCP016, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Named o perator ' 'ERROR ECOGEASCP016, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Named o perator '
. $operator_named->{children}->[0] . ' requires exactly one argu ment, dying' ) . "\n"; . $operator_named->{children}->[0] . ' requires exactly one argu ment, dying' ) . "\n";
} }
elsif ( $operator_named_class eq 'Operator_100' ) { # Operator -> OP01_NAME D SubExpression elsif ( $operator_named_class eq 'Operator_100' ) { # Operator -> OP01_NAME D SubExpression
# this operator is implemented as a C++ function, must wrap in parenthes
es
$cpp_source_group->{CPP} .= $operator_named->{children}->[0] . q{(};
# DEV NOTE, CORRELATION #rp031: NEED UPGRADE: implement proper @array vs # START HERE: need handle PERLOPS_PERLTYPES 'keys' retval being hash not
$arrayref, %hash vs $hashref, dereferencing, etc. hashref???
# START HERE: need handle PERLOPS_PERLTYPES 'keys' retval being hash not
hashref???
# START HERE: need handle PERLOPS_PERLTYPES 'keys' retval being hash not
hashref???
# START HERE: need unwrap hashref from hash dereference operator as w/ a # RPerl::diag( 'in Operator::Named::Keys->ast_to_cpp__generate__CPPOPS_CP
rrayref in Scalar.pm; also need handle PERLOPS_PERLTYPES 'keys' retval being has PTYPES(), have $operator_named->{children}->[1] = ' . "\n" . RPerl::Parser::rper
h not hashref l_ast__dump($operator_named->{children}->[1]) . "\n" );
# START HERE: need unwrap hashref from hash dereference operator as w/ a
rrayref in Scalar.pm; also need handle PERLOPS_PERLTYPES 'keys' retval being has
h not hashref
# START HERE: need unwrap hashref from hash dereference operator as w/ a
rrayref in Scalar.pm; also need handle PERLOPS_PERLTYPES 'keys' retval being has
h not hashref
RPerl::diag( 'in Operator::Named::Keys->ast_to_cpp__generate__CPPOPS_CPP # DEV NOTE, CORRELATION #rp031: NEED UPGRADE: implement proper @array vs
TYPES(), have $operator_named->{children}->[1] = ' . "\n" . RPerl::Parser::rperl $arrayref, %hash vs $hashref, dereferencing, etc.
_ast__dump($operator_named->{children}->[1]) . "\n" );
die 'TMP DEBUG';
my string_hashref $cpp_source_subgroup = $operator_named->{children}->[1 # UPGRADE START HERE: do not require named operator or HashDereference below, on
]->ast_to_rperl__generate( $modes, $self ); ce we allow RPerl variables/subroutines to store/return non-reference %hashes; s
RPerl::Generator::source_group_append( $cpp_source_group, $cpp_source_su ync w/ PERLOPS_PERLTYPES above; create tests
bgroup ); # UPGRADE START HERE: do not require named operator or HashDereference below, on
ce we allow RPerl variables/subroutines to store/return non-reference %hashes; s
ync w/ PERLOPS_PERLTYPES above; create tests
# UPGRADE START HERE: do not require named operator or HashDereference below, on
ce we allow RPerl variables/subroutines to store/return non-reference %hashes; s
ync w/ PERLOPS_PERLTYPES above; create tests
# must have Perl named operator (AKA named function) or HashDereference
as only argument, because this operator requires non-reference hash input
my object $subexpression = $operator_named->{children}->[1];
my string $subexpression_class = ref $subexpression;
if ( (not exists $rperloperations::BUILTINS_PERL_NAMED->{$subexpressi
on_class})
and ( $subexpression_class ne 'SubExpression_162' )
and ( $subexpression_class ne 'HashDereference_236' )
and ( $subexpression_class ne 'HashDereference_237' ) )
{
die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASCP870, CODE GE
NERATOR, ABSTRACT SYNTAX TO C++: Named operator ' . q{'} . $operator_named->{chi
ldren}->[0] . q{'}
. ' requires Perl named operator (AKA named function) or HashDer
eference argument, received ' . $subexpression_class . ' instead, dying' ) . "\n
";
}
# unwrap HashDereference_236 and HashDereference_237 from SubExpression_
162
if ( $subexpression_class eq 'SubExpression_162' ) { # SubExpression
-> HashDereference
$subexpression = $subexpression->{children}->[0];
}
$subexpression_class = ref $subexpression;
my string_hashref $cpp_source_subgroup;
# this operator is implemented as a C++ function, must wrap operands in
parentheses
$cpp_source_group->{CPP} .= NAME_CPPOPS_CPPTYPES() . '(';
# NEED REMOVE OR MODIFY DURING UPGRADE
if ( exists $rperloperations::BUILTINS_PERL_NAMED->{$subexpression_class
} ) {
die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASCP8xx, CODE GE
NERATOR, ABSTRACT SYNTAX TO C++: Named operator ' . q{'} . $operator_named->{chi
ldren}->[0] . q{'}
. ' received Perl named operator (AKA named function) argument '
. $subexpression_class . '; this feature is not yet supported, dying' ) . "\n";
}
$cpp_source_group->{CPP} .= q{)}; # DEV NOTE, CORRELATION #rp031: NEED UPGRADE: implement proper @array vs $arrayref, %hash vs $hashref, dereferencing, etc.
} # UPGRADE START HERE: do not unwrap and disregard HashDereference @{...} operato
r below, must actually perform dereference by unwrapping std::vector from std::u
nique_ptr<std::vector>
# UPGRADE START HERE: do not unwrap and disregard HashDereference @{...} operato
r below, must actually perform dereference by unwrapping std::vector from std::u
nique_ptr<std::vector>
# UPGRADE START HERE: do not unwrap and disregard HashDereference @{...} operato
r below, must actually perform dereference by unwrapping std::vector from std::u
nique_ptr<std::vector>
elsif ( $subexpression_class eq 'HashDereference_236' ) { # HashDeref
erence -> '@{' Variable '}'
$cpp_source_subgroup = $subexpression->{children}->[1]->ast_to_cpp__
generate__CPPOPS_CPPTYPES($modes);
RPerl::Generator::source_group_append( $cpp_source_group, $cpp_sourc
e_subgroup );
}
elsif ( $subexpression_class eq 'HashDereference_237' ) { # HashDeref
erence -> '@{' TypeInner? HashReference '}'
my object $type_inner_optional = $subexpression->{children}->[1];
my object $hash_reference = $subexpression->{children}->[2];
# DEV NOTE: in CPPOPS_CPPTYPES, must cast hashref data to proper typ
e as provided by TypeInner
if ( exists $type_inner_optional->{children}->[0] ) {
$cpp_source_group->{CPP} .= '((';
$cpp_source_subgroup = $type_inner_optional->{children}->[0]->as
t_to_cpp__generate__CPPOPS_CPPTYPES($modes);
# RPerl::diag( 'in NamedUnary::Scalar->ast_to_cpp__generate__CPPO
PS_CPPTYPES(), have $cpp_source_subgroup = ' . "\n" . RPerl::Parser::rperl_ast__
dump($cpp_source_subgroup) . "\n" );
RPerl::Generator::source_group_append( $cpp_source_group, $cpp_s
ource_subgroup );
$cpp_source_group->{CPP} .= ') ';
$cpp_source_subgroup = $hash_reference->ast_to_cpp__generate__CP
POPS_CPPTYPES($modes);
RPerl::Generator::source_group_append( $cpp_source_group, $cpp_s
ource_subgroup );
$cpp_source_group->{CPP} .= ')';
}
else {
die RPerl::Parser::rperl_rule__replace(
'ERROR ECOGEASCP872, CODE GENERATOR, ABSTRACT SYNTAX TO C++:
Hash dereference of hash reference must provide data type for hash reference in
CPPOPS_CPPTYPES mode, but no data type provided, dying'
) . "\n";
}
}
else {
die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASCP000, CODE GE
NERATOR, ABSTRACT SYNTAX TO C++: Grammar rule '
. $subexpression_class
. ' found where HashDereference_236 or HashDereference_237 e
xpected, dying' )
. "\n";
}
$cpp_source_group->{CPP} .= ')';
}
elsif ( $operator_named_class eq 'Operator_101' ) { # Operator -> LPAREN OP0 1_NAMED ListElement OP21_LIST_COMMA ListElements ')' elsif ( $operator_named_class eq 'Operator_101' ) { # Operator -> LPAREN OP0 1_NAMED ListElement OP21_LIST_COMMA ListElements ')'
die RPerl::Parser::rperl_rule__replace( die RPerl::Parser::rperl_rule__replace(
'ERROR ECOGEASCP014, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Named o perator ' 'ERROR ECOGEASCP014, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Named o perator '
. $operator_named->{children}->[1] . ' does not accept multiple arguments, dying' ) . "\n"; . $operator_named->{children}->[1] . ' does not accept multiple arguments, dying' ) . "\n";
} }
elsif ( $operator_named_class eq 'OperatorVoid_140' ) { # OperatorVoid -> OP 01_NAMED ListElement OP21_LIST_COMMA ListElements ';' elsif ( $operator_named_class eq 'OperatorVoid_140' ) { # OperatorVoid -> OP 01_NAMED ListElement OP21_LIST_COMMA ListElements ';'
die RPerl::Parser::rperl_rule__replace( die RPerl::Parser::rperl_rule__replace(
'ERROR ECOGEASCP014, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Named o perator ' 'ERROR ECOGEASCP014, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Named o perator '
. $operator_named->{children}->[0] . ' does not accept multiple arguments, dying' ) . "\n"; . $operator_named->{children}->[0] . ' does not accept multiple arguments, dying' ) . "\n";
} }
 End of changes. 11 change blocks. 
29 lines changed or deleted 134 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)