galapagos icon indicating copy to clipboard operation
galapagos copied to clipboard

Binary Numbers

Open jeremeamia opened this issue 12 years ago • 2 comments

It doesn't look like nikic/PHP-Parser keeps track of how the number is written. It looks like zero-prefixed numbers are just converted to decimal, and printed back out as decimal: https://github.com/nikic/PHP-Parser/blob/master/lib/PHPParser/Node/Scalar/LNumber.php#L36-L50. Is this an acceptable transformation as is?

jeremeamia avatar Dec 27 '13 18:12 jeremeamia

Yeah, I noticed that too. I accepted it, since it makes no functional difference. But maybe open a ticket on nikic/php-parser?

Similar one is array syntax is switched around.

igorw avatar Dec 27 '13 20:12 igorw

If you want to preserve the formatting of numbers or strings, you need to do so manually, see for example https://github.com/nikic/PHP-Parser/issues/26. Though in this case the translation is likely in your favor as it automatically supports binary numbers and short array syntax on 5.3 ;)

nikic avatar Dec 27 '13 21:12 nikic