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

Complex hash RHS values produces syntax error in the generated code #97

Open snoopyjc opened 2 years ago

snoopyjc commented 2 years ago

Complex hash RHS values produces syntax error in the generated code. For example:

    my %hop = (     "AClli" => $AClli,
        "ZClli" => $ZClli,
        "ID" => $circuitRow[$colNames{"ID"}],
        "mileage" => $circuitRow[$colNames{"mileage"}], 
        "type" => $circuitRow[$colNames{"type"}]
    );

produces:

        hop = {'AClli': AClli, 'ZClli': ZClli,
                   'ID': circuitRow[colNames['ID']]:'mileage': circuitRow[colNames['mileage']], 
                   'type': circuitRow[colNames['type']]}

Note the : before mileage instead of a ,.

snoopyjc commented 2 years ago

Fixed in https://github.com/snoopyjc/pythonizer