Properly highlight hex and binary numeric literals
Some checks failed
timw4mail/php-kilo/pipeline/head There was a failure building this commit
Some checks failed
timw4mail/php-kilo/pipeline/head There was a failure building this commit
This commit is contained in:
parent
c928be2d73
commit
ad90dcc775
10
src/Row.php
10
src/Row.php
@ -306,7 +306,7 @@ class Row {
|
|||||||
if ($i < strlen($this->render))
|
if ($i < strlen($this->render))
|
||||||
{
|
{
|
||||||
$nextChar = $this->render[$i];
|
$nextChar = $this->render[$i];
|
||||||
if ($nextChar !== '.' && ! is_digit($nextChar))
|
if (stripos('abcdefx.1234567890', $nextChar) === FALSE)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -469,15 +469,15 @@ class Row {
|
|||||||
*/
|
*/
|
||||||
protected function highlightCharacter(int &$i, Syntax $opts): bool
|
protected function highlightCharacter(int &$i, Syntax $opts): bool
|
||||||
{
|
{
|
||||||
if (($i + 1) >= $this->rsize)
|
$char = $this->render[$i];
|
||||||
|
|
||||||
|
if (($i + 1) >= $this->rsize || $char !== "'")
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$char = $this->render[$i];
|
|
||||||
$nextChar = $this->render[$i + 1];
|
$nextChar = $this->render[$i + 1];
|
||||||
|
|
||||||
if ($opts->characters() && $char === "'")
|
if ($opts->characters())
|
||||||
{
|
{
|
||||||
$offset = ($nextChar === '\\') ? $i + 3 : $i + 1;
|
$offset = ($nextChar === '\\') ? $i + 3 : $i + 1;
|
||||||
$closingIndex = strpos($this->render, "'", $offset);
|
$closingIndex = strpos($this->render, "'", $offset);
|
||||||
|
Loading…
Reference in New Issue
Block a user