softpano / pythonizer

Translator (or more correctly transcriber) from Perl to Python
http://www.softpanorama.org/Scripting/Pythonorama/Python_for_perl_programmers/Pythonizer/index.shtml
Other
39 stars 17 forks source link

Perl single line "if" statement fails - Deeep Recursion > 256 message - simple "if" passes...Please advise how to rewite this :if: #131

Closed pateshix closed 2 years ago

pateshix commented 2 years ago

!/usr/XDLLC/bin/perl -w

April 5, 2019, add option to run EMX only

if($#ARGV < 0 ){ print(" if.pl input_file \n"); exit; }

if (exists($tc[$idev]{options})) { $emx_extra_option=$tc[$idev]{options}; } else { $emx_extra_option=""; }

PYTHONIZER: Fuzzy translator of Python to Perl. Version 0.871 (mtime 220303_1246) Started at 22/03/09 15:10

Logs are at /tmp/Pythonizer/pythonizer.220309_1510.log. Type -h for help.

[Softpano-W313]: Debug flag is set to 3 Results of transcription are written to the file if.py

DETECTED GLOBAL VARIABLES:

List of local subroutines: main 1 | 0 | |#!/usr/bin/python3 -u 1 | 0 | | 2 | 0 | |#!/usr/intel/bin/perl -w 3 | 0 | | 4 | 0 | |# April 5, 2019, add option to run EMX only 5 | 0 | |import sys,os,re 5 | 0 | |import fileinput,subprocess,inspect

=== Line 5 Perl source:if($#ARGV < 0 ){===

Line: 5 TokenStr: =|c(s>d)|= @ValPy: if ( (len(ARGV)-1) < 0 ) 5 | 0 | |if (len(ARGV)-1)<0: #PL: if($#ARGV < 0 ){

=== Line 5 Perl source:{===

Line: 5 TokenStr: =|{|= @ValPy: {

=== Line 6 Perl source:print(" if3.pl input_file \n");===

Line: 6 TokenStr: =|f(")|= @ValPy: print ( ' if3.pl input_file \n' ) 6 | 1 | | print((' if3.pl input_file \n')) #PL: print(" if3.pl input_file \n");

=== Line 7 Perl source:exit;===

Line: 7 TokenStr: =|f|= @ValPy: sys.exit Use of uninitialized value $limit in addition (+) at pythonizer line 1384, <> line 7. 7 | 1 | | sys.exit() #PL: exit;

=== Line 8 Perl source:}===

Line: 8 TokenStr: =|}|= @ValPy: } 9 | 0 | |

=== Line 10 Perl source:if (exists($tc[$idev]{options})) {===

Line: 10 TokenStr: =|c(f(s(s)|= @ValPy: if ( in ( tc [ idev ] Deep recursion on subroutine "main::expression" at pythonizer line 1240, <> line 10. Deep recursion on subroutine "main::expression" at pythonizer line 1527, <> line 10. LINE 10 [Perlscan-T1147]: The number of generated chunk exceeded 256 LINE 10 [Perlscan-T1148]: First generated chunk is if . The last generated chunk before infinite loop is ( ABEND in module Perlscan. Line 10 : if (exists($tc[$idev]{options})) { You might need to exclude or simplify the line. Please refer to the user guide as for how to troubleshoot this situation

logfile:

PYTHONIZER: Fuzzy translator of Python to Perl. Version 0.871 (mtime 220303_1246) Started at 22/03/09 15:10

Logs are at /tmp/Pythonizer/pythonizer.220309_1510.log. Type -h for help.

[Softpano-W313]: Debug flag is set to 3 Results of transcription are written to the file if.py

DETECTED GLOBAL VARIABLES:

List of local subroutines: main 1 | 0 | |#!/usr/bin/python3 -u 1 | 0 | | 2 | 0 | |#!/usr/intel/bin/perl -w 3 | 0 | | 4 | 0 | |# April 5, 2019, add option to run EMX only 5 | 0 | |import sys,os,re 5 | 0 | |import fileinput,subprocess,inspect 5 | 0 | |if (len(ARGV)-1)<0: #PL: if($#ARGV < 0 ){ 6 | 1 | | print((' if3.pl input_file \n')) #PL: print(" if3.pl input_file \n"); 7 | 1 | | sys.exit() #PL: exit; 9 | 0 | | LINE 10 [Perlscan-T1147]: The number of generated chunk exceeded 256 LINE 10 [Perlscan-T1148]: First generated chunk is if . The last generated chunk before infinite loop is ( ABEND in module Perlscan. Line 10 : if (exists($tc[$idev]{options})) { You might need to exclude or simplify the line. Please refer to the user guide as for how to troubleshoot this situation

snoopyjc commented 2 years ago

Try using my version: https://github.com/snoopyjc/pythonizer

pateshix commented 2 years ago

Works great! handles nested "if" Thanks You!!!