Skip to content

Commit

Permalink
Perlito5 - cpan - prepare v9.022
Browse files Browse the repository at this point in the history
fglock committed May 13, 2017
1 parent 30e6fbb commit e2cdc2c
Showing 7 changed files with 25 additions and 12 deletions.
10 changes: 5 additions & 5 deletions perlito5.pl
Original file line number Diff line number Diff line change
@@ -4839,7 +4839,7 @@
$MATCH->{'capture'} = Perlito5::AST::Block::->new('stmts' => \@ast)
}
elsif ($Perlito5::EMIT_USE) {;
$MATCH->{'capture'} = Perlito5::Grammar::Block::ast_nop()
$MATCH->{'capture'} = Perlito5::AST::Apply::->new('code' => 'use', 'special_arg' => Perlito5::AST::Apply::->new('code' => $full_ident, 'bareword' => 1, 'arguments' => []), 'arguments' => $list)
}
else {;
$MATCH->{'capture'} = parse_time_eval({'mod' => $full_ident, 'code' => $use_decl, 'arguments' => $list})
@@ -15880,7 +15880,7 @@
if ($self->{'code'} eq 'package') {;
return ['stmt' => 'package', ['bareword' => $self->{'namespace'}]]
}
if ($code eq 'map' || $code eq 'grep' || $code eq 'sort' || $code eq 'print') {
if ($code eq 'map' || $code eq 'grep' || $code eq 'sort' || $code eq 'print' || $code eq 'use') {
if ($self->{'special_arg'}) {;
return ['op' => 'prefix:<' . $code . '>', $self->{'special_arg'}->emit_perl5(), ['op' => 'list:<,>', $self->emit_perl5_args()]]
}
@@ -16033,7 +16033,7 @@
$op{'prefix:<' . $_ . '>'} = {'fix' => 'prefix', 'prec' => 8, 'str' => $_ . ' '}
for '-r', '-w', '-x', '-o', '-R', '-W', '-X', '-O', '-e', '-z', '-s', '-f', '-d', '-l', '-p', '-S', '-b', '-c', '-t', '-u', '-g', '-k', '-T', '-B', '-M', '-A', '-C';
$op{'prefix:<' . $_ . '>'} = {'fix' => 'parsed', 'prec' => 15, 'str' => $_}
for 'do', 'sub', 'my', 'our', 'state', 'local', 'eval', 'map', 'grep', 'sort', 'print';
for 'do', 'sub', 'my', 'our', 'state', 'local', 'eval', 'map', 'grep', 'sort', 'print', 'use';
my %tab;
sub Perlito5::Perl5::PrettyPrinter::tab {
my $level = $_[0];
@@ -29008,8 +29008,8 @@
';
my $copyright_message = 'This is Perlito5 ' . $_V5_COMPILER_VERSION . ', an implementation of the Perl language.

The Perl language is Copyright 1987-2012, Larry Wall
The Perlito5 implementation is Copyright 2011, 2012 by Flavio Soibelmann Glock and others.
The Perl language is Copyright 1987-2017, Larry Wall
The Perlito5 implementation is Copyright 2011-2017 by Flavio Soibelmann Glock and others.

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
2 changes: 2 additions & 0 deletions src5/lib/Perlito5/CompileTime/Dumper.pm
Original file line number Diff line number Diff line change
@@ -32,6 +32,7 @@ sub generate_eval_string {

sub _dump_AST_from_scope {
my ($name, $item, $vars, $dumper_seen,) = @_;
no strict 'refs';

my $sigil = substr($name, 0, 1);
if (ref($item) eq 'Perlito5::AST::Sub' && $item->{name}) {
@@ -240,6 +241,7 @@ sub emit_globals_after_BEGIN {

# dump @ISA
for my $pkg (keys %{$Perlito5::PACKAGES}) {;
no strict 'refs';
if (@{ $pkg . "::ISA" }) {
$scope->{ '@' . $pkg . "::ISA" } //= {
'ast' => Perlito5::AST::Var->new(
4 changes: 2 additions & 2 deletions src5/lib/Perlito5/Grammar/Attribute.pm
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ sub opt_attribute {
$ws = Perlito5::Grammar::Space::opt_ws( $str, $ws->{to} + 1 );
my $p = $ws->{to};
my $m = Perlito5::Grammar::ident($str, $p);
Perlito5::Compiler::error "syntax error" if !$m;
Perlito5::Compiler::error( "syntax error" ) if !$m;

my $to;
while (1) {
@@ -26,7 +26,7 @@ sub opt_attribute {
if ($delimiter eq '(') {
# "ident(params)"
my $params = Perlito5::Grammar::String::string_interpolation_parse($str, $m->{to} + 1, '(', ')', 0);
Perlito5::Compiler::error "syntax error" if !$params;
Perlito5::Compiler::error( "syntax error" ) if !$params;
$attr->[1] = Perlito5::Match::flat($params)->{buf};
$to = $params->{to};
}
2 changes: 1 addition & 1 deletion src5/lib/Perlito5/Grammar/Sigil.pm
Original file line number Diff line number Diff line change
@@ -270,7 +270,7 @@ sub term_sigil {
}
if ($str->[$p] eq '}') {
# ${}
Perlito5::Compiler::error "syntax error";
Perlito5::Compiler::error( "syntax error" );
}
$m = Perlito5::Grammar::block( $str, $p0 );
if ($m) {
16 changes: 13 additions & 3 deletions src5/lib/Perlito5/Grammar/Use.pm
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ token stmt_use {
{ # "use v5", "use v5.8" - check perl version
my $version = $MATCH->{"version_string"}{capture}{buf};
Perlito5::test_perl_version($version);
$MATCH->{capture} = Perlito5::Grammar::Block::ast_nop;
$MATCH->{capture} = Perlito5::Grammar::Block::ast_nop();
}
|
<Perlito5::Grammar::full_ident> [ '-' <Perlito5::Grammar::ident> ]?
@@ -162,7 +162,17 @@ token stmt_use {
}
else {
if ($Perlito5::EMIT_USE) {
$MATCH->{capture} = Perlito5::Grammar::Block::ast_nop;
$MATCH->{capture} = Perlito5::AST::Apply->new(
code => 'use',
# namespace => 'CORE',
special_arg =>
Perlito5::AST::Apply->new(
code => $full_ident,
bareword => 1,
arguments => [],
),
arguments => $list,
);
}
else {
$MATCH->{capture} = parse_time_eval(
@@ -249,7 +259,7 @@ sub parse_time_eval {
bootstrapping_use($ast);
}

return Perlito5::Grammar::Block::ast_nop;
return Perlito5::Grammar::Block::ast_nop();
}

sub emit_time_eval {
1 change: 1 addition & 0 deletions src5/lib/Perlito5/Perl5/Emitter.pm
Original file line number Diff line number Diff line change
@@ -389,6 +389,7 @@ package Perlito5::AST::Apply;
|| $code eq 'grep'
|| $code eq 'sort'
|| $code eq 'print'
|| $code eq 'use'
) {
if ( $self->{special_arg} ) {
# TODO - test 'special_arg' type (scalar, block, ...)
2 changes: 1 addition & 1 deletion src5/lib/Perlito5/Perl5/PrettyPrinter.pm
Original file line number Diff line number Diff line change
@@ -161,7 +161,7 @@ $op{ "prefix:<$_>" } = { fix => 'prefix', prec => 8, str => "$_ " }
);
$op{ "prefix:<$_>" } = { fix => 'parsed', prec => 15, str => "$_" }
for qw( do sub my our state local
eval map grep sort print );
eval map grep sort print use );

my %tab;
sub tab {

0 comments on commit e2cdc2c

Please sign in to comment.