1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-11-30 04:19:30 +01:00

Fix emulation of binary floats

All binary literals were lexed as integers, even if they were floats
This commit is contained in:
nikic 2012-01-15 15:19:07 +01:00
parent bf252b2813
commit faf0351bab

View File

@ -55,7 +55,9 @@ class PHPParser_Lexer_Emulative extends PHPParser_Lexer
&& preg_match('(^__EMU__([A-Z]++)__(?:([A-Za-z0-9]++)__)?$)', $this->tokens[$i + 1][1], $matches)
) {
if ('BINARY' === $matches[1]) {
$replace = array(array(T_LNUMBER, $matches[2], $this->tokens[$i + 1][2]));
$replace = array(
array(is_int(bindec($matches[2])) ? T_LNUMBER : T_DNUMBER, $matches[2], $this->tokens[$i + 1][2])
);
} elseif ('NS' === $matches[1]) {
$replace = array('\\');
} elseif ('NOWDOC' === $matches[1]) {