Minor refactor

This commit is contained in:
Timothy Warren 2019-11-06 14:55:32 -05:00
parent d3bf9294cc
commit ae5228a6f1
1 changed files with 4 additions and 3 deletions

View File

@ -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