js2php
js2php copied to clipboard
brackets are lost
function foo( a, b, c, d ) {
return ( a + b ) * ( c + d );
}
is incorrectly converted to
<?php
function foo($a, $b, $c, $d) {
return $a + $b * $c + $d; //should be ($a + $b) * ($c + $d)
}
the brackets are lost.
tested on http://endel.me/js2php/
I can confirm this
This problem is because the tool uses only the AST node tree to rewrite the code, without taking the tokens into consideration. Each ( and ) are tokens that are not present in the AST node tree. You can inspect the results of espree.parse() to confirm this.