From ae5228a6f1b36d40ec8eab39b89dace9c0c730df Mon Sep 17 00:00:00 2001 From: Timothy J Warren Date: Wed, 6 Nov 2019 14:55:32 -0500 Subject: [PATCH] Minor refactor --- src/Row.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Row.php b/src/Row.php index d9296dc..062bc00 100644 --- a/src/Row.php +++ b/src/Row.php @@ -526,13 +526,14 @@ class Row { { continue; } - $charEnd = $charStart + $charLen; // Probably not great to create a closure in a loop like this, but // this halves the boilerplate for each type of syntax - $highlightRange = function (int $hl) use ($charLen, $charStart, $charEnd, &$offset) { + $highlightRange = function (int $hl) use ($charLen, $charStart, &$offset) { array_replace_range($this->hl, $charStart, $charLen, $hl); - $offset = $charEnd; + + // Update the offset to the end of the current token + $offset = $charStart + $charLen; }; // Start of multiline comment/single line comment