NumericLiteralSeparatorEmulator
extends TokenEmulator
in package
FinalYes
Table of Contents
Constants
- BIN = '(?:0b[01]+(?:_[01]+)*)'
- DEC = '(?:[0-9]+(?:_[0-9]+)*)'
- EXP = '(?:e[+-]?' . self::DEC . ')'
- FLOAT = '(?:' . self::SIMPLE_FLOAT . self::EXP . '?|' . self::DEC . self::EXP . ')'
- HEX = '(?:0x[0-9a-f]+(?:_[0-9a-f]+)*)'
- NUMBER = '~' . self::FLOAT . '|' . self::BIN . '|' . self::HEX . '|' . self::DEC . '~iA'
- SIMPLE_FLOAT = '(?:' . self::DEC . '\\.' . self::DEC . '?|\\.' . self::DEC . ')'
Methods
- emulate() : array<string|int, mixed>
- getPhpVersion() : string
- isEmulationNeeded() : bool
- reverseEmulate() : array<string|int, mixed>
- resolveIntegerOrFloatToken() : int
Constants
BIN
public
mixed
BIN
= '(?:0b[01]+(?:_[01]+)*)'
DEC
public
mixed
DEC
= '(?:[0-9]+(?:_[0-9]+)*)'
EXP
public
mixed
EXP
= '(?:e[+-]?' . self::DEC . ')'
FLOAT
public
mixed
FLOAT
= '(?:' . self::SIMPLE_FLOAT . self::EXP . '?|' . self::DEC . self::EXP . ')'
HEX
public
mixed
HEX
= '(?:0x[0-9a-f]+(?:_[0-9a-f]+)*)'
NUMBER
public
mixed
NUMBER
= '~' . self::FLOAT . '|' . self::BIN . '|' . self::HEX . '|' . self::DEC . '~iA'
SIMPLE_FLOAT
public
mixed
SIMPLE_FLOAT
= '(?:' . self::DEC . '\\.' . self::DEC . '?|\\.' . self::DEC . ')'
Methods
emulate()
public
emulate(string $code, array<string|int, mixed> $tokens) : array<string|int, mixed>
Parameters
- $code : string
- $tokens : array<string|int, mixed>
Return values
array<string|int, mixed>getPhpVersion()
public
getPhpVersion() : string
Return values
stringisEmulationNeeded()
public
isEmulationNeeded(string $code) : bool
Parameters
- $code : string
Return values
boolreverseEmulate()
public
reverseEmulate(string $code, array<string|int, mixed> $tokens) : array<string|int, mixed>
Parameters
- $code : string
- $tokens : array<string|int, mixed>
Return values
array<string|int, mixed>resolveIntegerOrFloatToken()
private
resolveIntegerOrFloatToken(string $str) : int
Parameters
- $str : string