nicolasrod / php2python

Convert PHP code to Python under CGI (beta)
MIT License
47 stars 22 forks source link

Assignments in Expressions #5

Open nicolasrod opened 4 years ago

nicolasrod commented 4 years ago

Convert any assignment to an assignment and a statement. For example:

$a = 1;
if ($a++ > 1) {
   echo 'a is greater than 1';
}

Turns into:

a = 1
if a > 1:
  a += 1

Some expressions are already translated. It is needed to evaluate every potential place where Python is expecting an expression and if an assignment is found, deal with it.