Skip to content

Commit c47a87a

Browse files
authored
Add files via upload
1 parent d2aaba2 commit c47a87a

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

pythonizer

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/perl
2-
## pythonizer Version 0.55 (Sept 2, 2020)
3-
## Fuzzy prettyprint STDERR for Perl scripts
4-
## Copyright Nikolai Bezroukov, 2019-2020.
2+
## pythonizer -- Translator of the subset of Perl 5 to Python 3.x
3+
## Copyright Nikolai Bezroukov, 2019-2021.
54
## Licensed under Perl Artistic license
65
##
76
## As most Perl statement are simple over 80% of them usually allow sucessful translation. That's why we use the term "fuzzy" translation.
@@ -85,6 +84,7 @@
8584
# 0.850 2020/10/12 BEZROUN print translation improved; many fixes in lex analyser
8685
# 0.860 2020/10/14 BEZROUN Python 2.7 mode eliminated to simplify the code. Option -p removed. "since" test passed
8786
# 0.870 2020/10/21 BEZROUN Treatment of brackets systematised. The code of subroutine expression revised.
87+
# 0.871 2021/05/10 BEZROUN Minor corrections in the header.
8888
#!start ===============================================================================================================================
8989

9090
use v5.10.1;
@@ -103,7 +103,7 @@
103103

104104
use Pythonizer qw(correct_nest getline prolog output_line @LocalSub %GlobalVar);
105105

106-
$VERSION='0.85';
106+
$VERSION='0.871';
107107
$SCRIPT_NAME='pythonizer';
108108
#
109109
# options
@@ -159,7 +159,7 @@
159159
#
160160
@Perlscan::BufferValClass=@Perlscan::BufferValCom=@Perlscan::BufferValPerl=@Perlscan::BufferValPy=(); # cleaning after the first pass
161161
my ($start,$token_buffer_active);
162-
$CurSub='main'; # default value of the current subroutine
162+
$CurSub='main';
163163
$token_buffer_active=0;
164164
$we_are_in_sub_body=0;
165165
while( defined($line) || scalar(@Perlscan::BufferValClass)>0 ){
@@ -450,6 +450,7 @@ my ($start,$token_buffer_active);
450450
$rc=open_fun(0,'s');
451451
}else{
452452
$TrStatus=function(0);
453+
453454
}
454455
}elsif( $ValClass[0] eq 'x' ){
455456
# this is backquotes
@@ -1302,12 +1303,7 @@ my ($k, $split, $split2, $delta, $dict, $incr, $arg1, $arg2, $perl_name, $py_nam
13021303
}elsif($perl_name eq 'shift' ){
13031304
# assent only a single arg -- array; if no argument then it uses @_ array
13041305
if( $bracketed==-1 ){
1305-
if( $CurSub eq 'main' || $Pythonizer::CurNest==0 ){
1306-
$arg1='sys.argv';
1307-
}else{
1308-
$arg1='perl_arg_array';
1309-
}
1310-
gen_chunk("$arg1$py_name");
1306+
gen_chunk("perl_arg_array$py_name");
13111307
}elsif( $end_pos==$start ){
13121308
gen_chunk($ValPy[$start],$py_name);
13131309
}else{
@@ -1376,7 +1372,7 @@ my ($k, $split, $split2, $delta, $dict, $incr, $arg1, $arg2, $perl_name, $py_nam
13761372
# single argument
13771373
gen_chunk('('.$ValPy[$start].')')
13781374
}elsif( $bracketed==1 ){
1379-
$TrStatus=expression($start,$end_pos,1);
1375+
$TrStatus=expression($start,$end_pos,0);
13801376
return -255 if ($TrStatus<0);
13811377
}else{
13821378
gen_chunk('(');

0 commit comments

Comments
 (0)