Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Perlito5 - perl6 - TODO list; special variables fix
  • Loading branch information
fglock committed Oct 15, 2013
1 parent 8dbed68 commit 2120983
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
10 changes: 10 additions & 0 deletions TODO-perlito5
Expand Up @@ -245,12 +245,22 @@ TODO list for Perlito5

* Perl6 backend

-- <> is lines()

-- choose @*ARGS or @_ in shift() and pop()

-- typeglob assignment

-- "given" statement not implemented

-- refactoring sub arguments
my $x = $_[0];
my ($x, $y, @rest) = @_; # check if @_ is unused elsewhere in the sub

-- placeholder
my ($a, $, $c) = 1..3;
($a, *, $c) = 1..3;

-- __PACKAGE__

-- specialized refactoring for packages that introduce syntax
Expand Down
6 changes: 3 additions & 3 deletions perlito5.pl
Expand Up @@ -12569,7 +12569,7 @@ package Perlito5::AST::Proto;
sub Perlito5::AST::Proto::emit_perl6 {
my $self = $_[0];
if ($self->{'name'} eq '__PACKAGE__') {
return(['bareword' => $Perlito5::PKG_NAME])
return(['bareword' => '$?PACKAGE'])
}
return(['bareword' => $self->{'name'}])
}
Expand Down Expand Up @@ -12609,7 +12609,7 @@ package Perlito5::AST::Call;
}
package Perlito5::AST::Apply;
{
my %special_var = (chr(15) => '$*OS');
my %special_var = (chr(15) => '$*VM');
my %op_translate = ('list:<.>' => 'list:<~>', 'infix:<.=>' => 'infix:<~=>', 'infix:<=~>' => 'infix:<~~>', 'infix:<!~>' => 'infix:<!~~>', 'infix:<cmp>' => 'infix:<leq>', 'ternary:<? :>' => 'ternary:<?? !!>', 'reverse' => 'flip');
sub Perlito5::AST::Apply::emit_perl6_args {
my $self = $_[0];
Expand All @@ -12635,7 +12635,7 @@ package Perlito5::AST::Apply;
return(['keyword' => 'Inf'])
}
if ($code eq '__PACKAGE__' && !$self->{'namespace'}) {
return(['bareword' => $Perlito5::PKG_NAME])
return(['bareword' => '$?PACKAGE'])
}
if ($code eq 'prefix:<$#>') {
return(['op' => 'infix:<.>', $self->{'arguments'}->[0]->emit_perl6(), ['keyword' => 'end']])
Expand Down
6 changes: 3 additions & 3 deletions src5/lib/Perlito5/Perl6/Emitter.pm
Expand Up @@ -319,7 +319,7 @@ package Perlito5::AST::Proto;
sub emit_perl6 {
my $self = $_[0];
if ($self->{name} eq '__PACKAGE__') {
return [ bareword => $Perlito5::PKG_NAME ];
return [ bareword => '$?PACKAGE' ];
}
return [ bareword => $self->{name} ];
}
Expand Down Expand Up @@ -366,7 +366,7 @@ package Perlito5::AST::Call;
package Perlito5::AST::Apply;
{
my %special_var = (
chr(15) => '$*OS', # $^O
chr(15) => '$*VM', # $^O
);
my %op_translate = (
'list:<.>' => 'list:<~>',
Expand Down Expand Up @@ -403,7 +403,7 @@ package Perlito5::AST::Apply;
return [ keyword => 'Inf' ];
}
if ($code eq '__PACKAGE__' && !$self->{namespace}) {
return [ bareword => $Perlito5::PKG_NAME ];
return [ bareword => '$?PACKAGE' ];
}
if ($code eq 'prefix:<$#>') {
return [ op => 'infix:<.>', $self->{arguments}[0]->emit_perl6(), [ keyword => 'end' ] ];
Expand Down

0 comments on commit 2120983

Please sign in to comment.