Skip to content

Commit dfd8374

Browse files
committed
Remove unnecessary peek cache
1 parent 364a897 commit dfd8374

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

lib/Sabberworm/CSS/Parser.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class Parser {
3131
private $oParserSettings;
3232
private $sCharset;
3333
private $iLength;
34-
private $peekCache = null;
3534
private $blockRules;
3635
private $aSizeUnits;
3736

@@ -290,7 +289,6 @@ private function parseRuleSet($oRuleSet) {
290289
// We need to “unfind” the matches to the end of the ruleSet as this will be matched later
291290
if($this->streql(substr($sConsume, -1), '}')) {
292291
--$this->iCurrentPosition;
293-
$this->peekCache = null;
294292
} else {
295293
$this->consumeWhiteSpace();
296294
while ($this->comes(';')) {
@@ -488,19 +486,12 @@ private function comes($sString, $bCaseInsensitive = false) {
488486
}
489487

490488
private function peek($iLength = 1, $iOffset = 0) {
491-
if (($peek = (!$iOffset && ($iLength === 1))) &&
492-
!is_null($this->peekCache)) {
493-
return $this->peekCache;
494-
}
495489
$iOffset += $this->iCurrentPosition;
496490
if ($iOffset >= $this->iLength) {
497491
return '';
498492
}
499493
$iLength = min($iLength, $this->iLength-$iOffset);
500494
$out = $this->substr($iOffset, $iLength);
501-
if ($peek) {
502-
$this->peekCache = $out;
503-
}
504495
return $out;
505496
}
506497

@@ -511,15 +502,13 @@ private function consume($mValue = 1) {
511502
throw new UnexpectedTokenException($mValue, $this->peek(max($iLength, 5)));
512503
}
513504
$this->iCurrentPosition += $this->strlen($mValue);
514-
$this->peekCache = null;
515505
return $mValue;
516506
} else {
517507
if ($this->iCurrentPosition + $mValue > $this->iLength) {
518508
throw new UnexpectedTokenException($mValue, $this->peek(5), 'count');
519509
}
520510
$sResult = $this->substr($this->iCurrentPosition, $mValue);
521511
$this->iCurrentPosition += $mValue;
522-
$this->peekCache = null;
523512
return $sResult;
524513
}
525514
}

0 commit comments

Comments
 (0)